Skip to content

Commit

Permalink
fix x2 >= image_width and y2 >= image_height
Browse files Browse the repository at this point in the history
  • Loading branch information
light-and-ray committed Oct 28, 2024
1 parent 11971e8 commit 2cb3c2d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def expand_too_small_crop_region(crop_region, processing_width, processing_heigh
diff_w_r = diff_w - diff_w_l
x1 -= diff_w_l
x2 += diff_w_r
if x2 >= image_width:
diff = x2 - image_width
x2 -= diff
x1 -= diff
if x1 < 0:
x2 -= x1
x1 -= x1
Expand All @@ -102,6 +106,10 @@ def expand_too_small_crop_region(crop_region, processing_width, processing_heigh
diff_h_d = diff_h - diff_h_u
y1 -= diff_h_u
y2 += diff_h_d
if y2 >= image_height:
diff = y2 - image_height
y2 -= diff
y1 -= diff
if y1 < 0:
y2 -= y1
y1 -= y1
Expand Down

0 comments on commit 2cb3c2d

Please sign in to comment.