7

I compiled OpenCV 3 & opencv_contrib from the latest source code. I installed it into the site-packages folder for Python 2.7. I can follow all of the tutorials at http://docs.opencv.org/trunk/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.html except the ones involving SIFT.

Here is the error I get:

Traceback (most recent call last):
  File "C:\Projects\icu\ex01.py", line 9, in <module>
    sift = cv2.SIFT()
AttributeError: 'module' object has no attribute 'SIFT'

Please help. I searched & searched & searched and can't find anything related to OpenCV3.

Oh, and I used Visual Studio 2013 to build it.

1 Answer 1

12

as of 3.0, SIFT, SURF, BRIEF and FREAK were moved to a seperate opencv_contrib repo.

you will have to download that, add it to your main cmake settings (please see the README there), and rebuild the main opencv repo. after 'make install' your python should have a new cv2.pyd, that contains those again. then:

# note the additional namespace:
sift = cv2.xfeatures2d.SIFT_create() 
3
  • 5
    Why in the world did the official tutorial not mention extra space??!?
    – Maxim
    Nov 14, 2014 at 2:09
  • 3
    just builded opencv3, found sift module this way: sift = cv2.xfeatures2d.SIFT_create() Nov 21, 2014 at 5:37
  • 1
    If you are using brew install it like this: brew install opencv3 --with-contrib Jul 5, 2015 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.