INNER CODE UNIT · Python
center_x
Shilin-LU/TF-ICON · scripts/app.py:169
center_x = x + new_w / 2
center_y = y + new_h / 2
# Calculate the percentage from the top and left
center_row_from_top = round(center_y / 512, 2)
center_col_from_left = round(center_x / 512, 2)
aspect_ratio = new_h / new_w
if aspect_ratio > 1:
mask_scale = new_w * aspect_ratio / 256
mask_scale = new_h / 256
else:
mask_scale = new_w / 256
mask_scale = new_h / (aspect_ratio * 256)
# mask_scale = round(mask_scale, 2)
# =============================================================================================