I am currently trying to set up the opencv trackers on a Raspberry Pi. However, when I use the MultiTracker_create() function, it gives me an Attribution Error:
multiTracker = cv2.MultiTracker_create()
AttributeError: module 'cv2.cv2' has no attribute 'MultiTracker_create'
The same code works on my computer, but when I try it on the Pi, it experiences the above error. I am currently using Python 3.5 on the Raspi with OpenCV 3.4.4. My computer uses Python 3.7 with OpenCV 3.4.1.
Thank you in advance for your help.
I have made sure that I am using the correct package: pip3 install opencv_contrib_python
I have also tried to look through the help(cv2) and could not find anything specific about the MultiTracker.
Just stumbled upon this myself. It appears that MultiTracker is no longer part of OpenCV 4.5.1, but you should be able to get it from the legacy package like this:
multiTracker = cv2.legacy.MultiTracker_create()
See https://docs.opencv.org/4.5.1/df/d4a/classcv_1_1legacy_1_1MultiTracker.html
Note that if you subsequently call multiTracker.add(...)
, you'll need to add the legacy version(s) of the trackers as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With