Skip to content

Commit

Permalink
Miscalculation bug corrected
Browse files Browse the repository at this point in the history
Corrected miscalculation bug of ymax and xmax size
  • Loading branch information
northumber authored Jan 12, 2024
1 parent 68f1c59 commit 2b45f05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions person_autocrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def object_detection(input_image_path, output_directory):
else:
ymin = int(ymin * image.shape[0])

if ymax + (ymax * 0.1) <= image.shape[0]:
if int((ymax + (ymax * 0.1)) * image.shape[0]) <= image.shape[0]:
ymax = int((ymax + (ymax * 0.1)) * image.shape[0])
else:
ymax = int(ymax * image.shape[0])
Expand All @@ -72,7 +72,7 @@ def object_detection(input_image_path, output_directory):
else:
xmin = int(xmin * image.shape[1])

if xmax + (xmax * 0.1) <= image.shape[1]:
if int((xmax + (xmax * 0.1)) * image.shape[1]) <= image.shape[1]:
xmax = int((xmax + (xmax * 0.1)) * image.shape[1])
else:
xmax = int(xmax * image.shape[1])
Expand Down

0 comments on commit 2b45f05

Please sign in to comment.