I'm trying to add the xfeatures2d
module from opencv_contrib
to an existing OpenCV/Python project.
I've downloaded the latest version of the module from the repo, and built OpenCV again with the following additional params:
OPENCV_EXTRA_MODULES_PATH=/path/to/opencv_contrib-master/modules
BUILD_opencv_xfeatures2d=ON
Excerpt from build log:
-- Installing: /usr/local/lib/python2.7/site-packages/cv2.so
-- Installing: /usr/local/lib/python3.4/site-packages/cv2.so
-- Installing: /usr/local/lib/libopencv_xfeatures2d.3.0.0.dylib
It appears the new module is installed correctly. I'm able to import cv2
in both Python versions. However neither recognise the new features the module is supposed to add.
>>> cv2.SURF()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'SURF'
>>> cv2.xfeatures2d.SURF()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'xfeatures2d'