0

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?

Marco A Medina
  • 45
  • 1
  • 2
  • 6
  • Does this answer your question? [sift = cv2.xfeatures2d.SIFT\_create() not working even though have contrib installed](https://stackoverflow.com/questions/52305578/sift-cv2-xfeatures2d-sift-create-not-working-even-though-have-contrib-instal) – HansHirse Feb 21 '20 at 06:16

1 Answers1

1

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