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?
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.
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!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With