I'm trying to start working with openCV but keep getting an attribute error: module 'cv2.cv2' has no attribute 'TrackerKCF_create'
I have searched around online a lot and all of the suggestions I keep finding are to run
pip install opencv-contrib-python
I did that (and tried uninstalling then reinstalling) and no luck, still getting the same error. If it matters, I have installed openCV version (3.4.3.18), python 3.6, am running it in Spyder, and my computer is running MacOS High Sierra. Any help would be greatly appreciated.
Posted Oct 2, 2018, 6:27 PM UTC
18
can you copy-paste your code here?
Sure thing, I’m class but will post it in half an hour.
Sorry if the formatting is weird, I'm not used to using reddit code syntax.
Fixing indentation and removing the unnecessary check for older OpenCV versions, it worked for me. Note that my version of OpenCV was compiled by me. I recommend you to do that, too.
Oh interesting, this is my first time using an API in python, may I ask how you compiled it yourself? Is there some guide I can follow? Thanks!
I usually build it on Windows. Haven't done that on MacOS for sometime. You can follow this guide though:
https://medium.com/coding-experiences/setting-up-opencv3-with-python3-on-macos-84be7909e28d
It's not a straightforward process but I'm pretty used to it. It comes with the benefit of adding many plugins and platform specific performance optimizations.
and here is a video I made: https://youtu.be/Trk70zKC-kQ