I wrote a program to test opencv trackers
but I got error. Here is my python
code using opencv 4.10.0
:
import cv2
video_path = '.../v1.mp4'
video = cv2.VideoCapture(video_path)
tracker = cv2.TrackerDaSiamRPN()
if not video.isOpened():
print("Could not open video")
# Read first frame.
ok, frame = video.read()
if not ok:
print('Cannot read video file')
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
roi = cv2.selectROI(frame, True)
tracker.init(frame, roi)
and this is the error message:
File “…opencv_trackers.py”, line 19, in
tracker.init(frame, roi) cv2.error: Unknown C++ exception from OpenCV code