Skip to content

Commit

Permalink
tweaked min width/height adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
fracpete committed Aug 2, 2021
1 parent dd2a925 commit 57d1464
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vfs/predictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def crop_frame(frame, predictions, margin=0, min_width=2, min_height=2, verbose=
log("Current: x0=%d, x1=%d" % (x0, x1))
inc = (min_width - curr_width) // 2
x0 = max(0, x0 - inc)
x1 = min(width - 1, x1 + inc)
x1 = min(width - 1, x0 + min_width)
if verbose:
log("Corrected: x0=%d, x1=%d" % (x0, x1))

Expand All @@ -152,7 +152,7 @@ def crop_frame(frame, predictions, margin=0, min_width=2, min_height=2, verbose=
log("Current: y0=%d, y1=%d" % (y0, y1))
inc = (min_height - curr_height) // 2
y0 = max(0, y0 - inc)
y1 = min(height - 1, y1 + inc)
y1 = min(height - 1, y0 + min_height)
if verbose:
log("Corrected: y0=%d, y1=%d" % (y0, y1))

Expand Down

0 comments on commit 57d1464

Please sign in to comment.