Reputation: 45
My python version = 3.7.4 cv2 version= 4.2.0
These are my version on python and open cv, Im trying to use SIFT function and I got the famous error module cv2.cv2' has no attribute 'SIFT'
, so I tried pip install opencv-contrib-python
and also python -m pip install --user opencv-contrib-python
, and I changed detector=cv2.SIFT()
to detector=cv2.xfeatures2d.SIFT_create()
and the error just changed to AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d'
I Tried with similar questions that I found, but are not working for me, I dont find a recent question, thats why Im opening this new because maybe as the version were different it could be the reason doesnt work for me
What else could I do?
Upvotes: 0
Views: 4130
Reputation: 51
SIFT and SURF are proprietary, patented algorithms. You'd need to compile OpenCV and OpenCV-contrib from source, with non-free packages enabled, building the python libraries. I wasn't able to get this working so I used pip to find an older version (3.4.2) that did not remove the non-free libraries. I may have had to roll back python but I'm not sure. I am using python 3.6.8
Upvotes: 1