error: OpenCV(4.5.4) : -1: error: (-5:Bad argument) in function ‘add’
Expected Ptr<cv::legacy::Tracker> for argument ‘newTracker‘
Problems encountered
error: OpenCV(4.5.4) : -1: error: (-5:Bad argument) in function ‘add’
Overload resolution failed:
- Expected Ptrcv::legacy::Tracker for argument 'newTracker'
- Expected Ptrcv::legacy::Tracker for argument 'newTracker'
Cause Analysis
Changes in the OpenCV official API have made the interface incompatible. You need to pay attention to the changes in its interface. It is strongly recommended to read the official documentation! ! !
solution
When applying the opencv (4.5.4) target tracking function, you first need to add legacy before MultiTracker_create, which is cv2.legacy.MultiTracker_create. At the same time, you also need to add legacy when creating the tracking algorithm, such as cv2.legacy.TrackerKCF_create()
reference
Link: https://ask.csdn.net/questions/7632086
Link: https://www.coder.work/article/7797640
Link: https://blog.csdn.net/qq_39052927/article/details/120665629