Search code examples
pythonopencvpython-2.7ubuntusift

SIFT() in opencv is not working: 'module' object has no attribute 'SURF'


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:

  • Ubuntu version is 13.10 64bit
  • cv2.__version__ is 2.4.5
  • the output of dir(cv2) is (for the S letter only)

'scaleAdd', 'segmentMotion', 'sepFilter2D', 'setIdentity', 'setMouseCallback', 'setTrackbarPos', 'setUseOptimized', 'setWindowProperty', 'solve', 'solveCubic', 'solvePnP', 'solvePnPRansac', 'solvePoly', 'sort', 'sortIdx', 'split', 'sqrt', 'startWindowThread', 'stereoCalibrate', 'stereoRectify', 'stereoRectifyUncalibrated', 'subtract', 'sumElems'


Solution

  • Not the smoothest way to do it, but it worked for me.

    @Berak explained to me, as you can observe in the comments on my question, that the SIFT algorithm, as well as FAST algorithm are patented, which means that they are not part of the regular opencv installation.

    Therefore I searched for a python distribution that will have it all - and I found one. So, I didn't actually solved the problem, as @Berak suggested, alternatively I bypassed it using Python(x,y)

    Thanks for the help,

    Ozrad