Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Surf missing in opencv 2.4 for python

I'm trying to instantiate a SURF object in python using OpenCV as described here but this happens:

>>> import cv2
>>> cv2.__version__
'2.4.0'
>>> cv2.SURF()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'SURF'

Does anyone know why this happens or if SURF is missing from the Python version of OpenCV?

like image 371
Cassidy Laidlaw Avatar asked May 22 '12 20:05

Cassidy Laidlaw


People also ask

Which version of OpenCV has surf?

To get access to the original SIFT and SURF implementations found in OpenCV 2.4. X, you'll need to pull down both the opencv and opencv_contrib repositories from GitHub and then compile and install OpenCV 3 from source.

How do I know what version of OpenCV I have?

Checking your OpenCV version: a real-world example X and OpenCV 3 to detect the contours (i.e. outlines) of the Tetris blocks. As you can see, all we need to do is make a call to is_cv2 , is_cv4 , and is_cv3 and then wrap our version specific code inside the if statement blocks — that's it!


1 Answers

It is a regression which should be fixed in the next library update.

But SURF is not really absent. You still can access it via the generic wrappers:

surf_detector = cv2.FeatureDetector_create("SURF")
surf_descriptor = cv2.DescriptorExtractor_create("SURF")

Update: cv2.SURF() is restored in OpenCV 2.4.1

like image 95
Andrey Kamaev Avatar answered Sep 21 '22 05:09

Andrey Kamaev