From 57d1464dca9d7498332dc172e3e9306ff52948c8 Mon Sep 17 00:00:00 2001 From: Peter Reutemann Date: Tue, 3 Aug 2021 10:42:33 +1200 Subject: [PATCH] tweaked min width/height adjustment --- src/vfs/predictions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vfs/predictions.py b/src/vfs/predictions.py index 012150e..eed5658 100644 --- a/src/vfs/predictions.py +++ b/src/vfs/predictions.py @@ -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)) @@ -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))