I am trying to access SIFT and SURF features from opencv 3 in python. As suggested by other people, I followed the installation of opencv_contrib. Some of the logs of the installation are:
[ 82%] Built target opencv_xfeatures2d
...
Installing: /usr/local/lib/libopencv_xfeatures2d.so
-- Set runtime path of "/usr/local/lib/libopencv_xfeatures2d.so.3.0.0" to "/usr/local/lib"
-- Installing: /usr/local/include/opencv2/xfeatures2d.hpp
-- Installing: /usr/local/include/opencv2/xfeatures2d/cuda.hpp
-- Installing: /usr/local/include/opencv2/xfeatures2d/nonfree.hpp
After that I import cv2 in python but could not import xfeatures2d.
>>> import cv2
>>> cv2.xfeatures2d.SIFT_create()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'xfeatures2d'
Also, cv2.__version__
gives '2.4.8'! How can I fix this?