I am trying to run the simplest opencv SIFT code through the shell of Ubuntu, with no luck
I get an error:
AttributeError: 'module' object has no attribute 'SURF'
The code:
import cv2
cv2.SIFT()
My configurations:
cv2.__version__
is 2.4.5'scaleAdd', 'segmentMotion', 'sepFilter2D', 'setIdentity', 'setMouseCallback', 'setTrackbarPos', 'setUseOptimized', 'setWindowProperty', 'solve', 'solveCubic', 'solvePnP', 'solvePnPRansac', 'solvePoly', 'sort', 'sortIdx', 'split', 'sqrt', 'startWindowThread', 'stereoCalibrate', 'stereoRectify', 'stereoRectifyUncalibrated', 'subtract', 'sumElems'
This was driving me crazy but scratch all the other suggestions, turns out you can now get SIFT and SURF with just two terminal commands!
Be sure there is no other opencv on you computer...
pip uninstall opencv-python
Then get the contribute version (has SIFT and SURF + others)...
pip install opencv-contrib-python
It should install but note that the names are a little different.
import cv2
sift = cv2.xfeatures2d.SIFT_create()
!!!pip pip hurray!!! (that's just a pun, not part of the code)