Skip to content

Commit

Permalink
fix get_crop_region_v2
Browse files Browse the repository at this point in the history
Co-Authored-By: Dowon <[email protected]>
  • Loading branch information
w-e-w and Bing-su committed Apr 22, 2024
1 parent e2b177c commit 821adc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_crop_region_v2(mask, pad=0):
mask = mask if isinstance(mask, Image.Image) else Image.fromarray(mask)
if box := mask.getbbox():
x1, y1, x2, y2 = box
return max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0]), min(y2 + pad, mask.size[1]) if pad else box
return (max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0]), min(y2 + pad, mask.size[1])) if pad else box


def get_crop_region(mask, pad=0):
Expand Down

0 comments on commit 821adc3

Please sign in to comment.