OpenCV Python and SIFT features

12,374

Solution 1

I can't say whether this is the reason SIFT was not available via Python for OpenCV 2.3 (as the original question asks). However, the patent which was preventing SIFT from being included in OpenCV expired on 2020-03-06.

The distributed build of OpenCV now includes SIFT since version 4.4.0, accessible via cv2.SIFT_create() in Python.

See the documentation for further information on its use.

Solution 2

Are you sure OpenCV is allowed to support SIFT? SIFT is a proprietary feature type, patented within the U.S. by the University of British Columbia and by David Lowe, the inventor of the algorithm. In my own research, I have had to re-write this algorithm many times. In fact, some vision researchers try to avoid SIFT and use other scale-invariant models because SIFT is proprietary.

Share:
12,374

Related videos on Youtube

Mathieu Dubois
Author by

Mathieu Dubois

Updated on July 13, 2022

Comments

  • Mathieu Dubois
    Mathieu Dubois almost 2 years

    I know there is a lot of questions about Python and OpenCV but I didn't find help on this special topic.

    I want to extract SIFT keypoints from an image in python OpenCV.

    I have recently installed OpenCV 2.3 and can access to SURF and MSER but not SIFT. I can't see anything related to SIFT in python modules (cv and cv2) (well I'm lying a bit: there are 2 constants: cv2.SIFT_COMMON_PARAMS_AVERAGE_ANGLE and cv2.SIFT_COMMON_PARAMS_FIRST_ANGLE).

    This puzzles me since a while. Is that related to the fact that some parts of OpenCV are in C and other in C++? Any idea?

    P.S.: I have also tried pyopencv (another python binding for OpenCV <= 2.1) without success.

  • Mathieu Dubois
    Mathieu Dubois over 12 years
    SIFT is in OpenCV (you can check the C++ documentation). Why it's not accessible from python is really mysterious. Sure there are ther interest point detectors but SIFT is kind of a baseline...
  • ely
    ely over 12 years
    Perhaps this link's Python code will be enough for what you need to do: < janeriksolem.net/2009/02/sift-python-implementation.html >. It looks like this would be very easy to mix with OpenCV code.
  • Mathieu Dubois
    Mathieu Dubois over 12 years
    Thanks. I have used tricks like that... And I think I will stick to that. But I still don't undertsand why SIFT is not accessible from Python.
  • Prashant Shrivastava
    Prashant Shrivastava over 9 years
    SIFT() is not working with cv2 library. i tried Python(x,y) as well, but with no success. Can u tell, from where u got the library? did u compile from source or any other method?
  • Andras Deak -- Слава Україні
    Andras Deak -- Слава Україні about 5 years
    This says the same thing as an answer from last year. If the version is important, clarify the other answer. It's also missing a lot of information to be a decent answer.