Skip to content

Commit b1322ea

Browse files
authored
Fix OpenCV version assertions in ViTTrack & RAFT and text offset (#234)
* Update OpenCV version assertions for Object Tracking and Optical Flow * Increased text offset to not overlap with the bounding box.
1 parent bdd60c2 commit b1322ea

File tree

2 files changed

+3
-3
lines changed
  • models

2 files changed

+3
-3
lines changed

models/object_tracking_vittrack/demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from vittrack import VitTrack
1010

1111
# Check OpenCV version
12-
assert cv.__version__ > "4.9.0", \
12+
assert cv.__version__ >= "4.9.0", \
1313
"Please install latest opencv-python to try this demo: python3 -m pip install --upgrade opencv-python"
1414

1515
# Valid combinations of backends and targets
@@ -52,7 +52,7 @@ def visualize(image, bbox, score, isLocated, fps=None, box_color=(0, 255, 0),tex
5252
# bbox: Tuple of length 4
5353
x, y, w, h = bbox
5454
cv.rectangle(output, (x, y), (x+w, y+h), box_color, 2)
55-
cv.putText(output, '{:.2f}'.format(score), (x, y+20), cv.FONT_HERSHEY_DUPLEX, fontScale, text_color, fontSize)
55+
cv.putText(output, '{:.2f}'.format(score), (x, y+25), cv.FONT_HERSHEY_DUPLEX, fontScale, text_color, fontSize)
5656
else:
5757
text_size, baseline = cv.getTextSize('Target lost!', cv.FONT_HERSHEY_DUPLEX, fontScale, fontSize)
5858
text_x = int((w - text_size[0]) / 2)

models/optical_flow_estimation_raft/demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from raft import Raft
77

88
# Check OpenCV version
9-
assert cv.__version__ > "4.9.0", \
9+
assert cv.__version__ >= "4.9.0", \
1010
"Please install latest opencv-python to try this demo: python3 -m pip install --upgrade opencv-python"
1111

1212
parser = argparse.ArgumentParser(description='RAFT (https://github.com/princeton-vl/RAFT)')

0 commit comments

Comments
 (0)