Surf missing in opencv 2.4 for python
Asked Answered
B

1

8

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?

Bezique answered 22/5, 2012 at 20:23 Comment(1)
That works just fine up to 2.3.2, and the docs say it should work too. What does dir(cv2) show you?Hillaryhillbilly
C
9

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

Casar answered 22/5, 2012 at 21:26 Comment(4)
Thanks, that works. What do you mean when you say it's a regression?Bezique
Can someone tell we what is the difference between the two versions (cv2.FeatureDetector_create("SURF") + cv2.DescriptorExtractor_create("SURF") vs. cv2.SURF()) expect that the second version is more compact?Arrowworm
Is it really fixed in 2.4.1? I'm trying to use 2.4.2 and am seeing the same error.Chiffchaff
@AndreyKamaev: I get a segfault when calling getParams() on the resulting object; how do I e.g. set upright to True?Pascia

© 2022 - 2024 — McMap. All rights reserved.