From 5c55988c6e986d30bf9f6188c0f1f4a36f9755c4 Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Mon, 26 Feb 2024 03:10:31 -0500 Subject: [PATCH 1/2] Update OpenCV version assertions for Object Tracking and Optical Flow --- models/object_tracking_vittrack/demo.py | 2 +- models/optical_flow_estimation_raft/demo.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/object_tracking_vittrack/demo.py b/models/object_tracking_vittrack/demo.py index 1396eb43..0fe1931b 100644 --- a/models/object_tracking_vittrack/demo.py +++ b/models/object_tracking_vittrack/demo.py @@ -9,7 +9,7 @@ from vittrack import VitTrack # Check OpenCV version -assert cv.__version__ > "4.9.0", \ +assert cv.__version__ >= "4.9.0", \ "Please install latest opencv-python to try this demo: python3 -m pip install --upgrade opencv-python" # Valid combinations of backends and targets diff --git a/models/optical_flow_estimation_raft/demo.py b/models/optical_flow_estimation_raft/demo.py index 67a63c76..f6a67218 100644 --- a/models/optical_flow_estimation_raft/demo.py +++ b/models/optical_flow_estimation_raft/demo.py @@ -6,7 +6,7 @@ from raft import Raft # Check OpenCV version -assert cv.__version__ > "4.9.0", \ +assert cv.__version__ >= "4.9.0", \ "Please install latest opencv-python to try this demo: python3 -m pip install --upgrade opencv-python" parser = argparse.ArgumentParser(description='RAFT (https://github.com/princeton-vl/RAFT)') From 64cebddd3d36a0212143b9db7f9610f2b18f6e5b Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Mon, 26 Feb 2024 03:16:50 -0500 Subject: [PATCH 2/2] Increased text offset to not overlap with the bounding box. --- models/object_tracking_vittrack/demo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/object_tracking_vittrack/demo.py b/models/object_tracking_vittrack/demo.py index 0fe1931b..6230d0db 100644 --- a/models/object_tracking_vittrack/demo.py +++ b/models/object_tracking_vittrack/demo.py @@ -52,7 +52,7 @@ def visualize(image, bbox, score, isLocated, fps=None, box_color=(0, 255, 0),tex # bbox: Tuple of length 4 x, y, w, h = bbox cv.rectangle(output, (x, y), (x+w, y+h), box_color, 2) - cv.putText(output, '{:.2f}'.format(score), (x, y+20), cv.FONT_HERSHEY_DUPLEX, fontScale, text_color, fontSize) + cv.putText(output, '{:.2f}'.format(score), (x, y+25), cv.FONT_HERSHEY_DUPLEX, fontScale, text_color, fontSize) else: text_size, baseline = cv.getTextSize('Target lost!', cv.FONT_HERSHEY_DUPLEX, fontScale, fontSize) text_x = int((w - text_size[0]) / 2)