"No attribute xfeatures2d" in Python: Even after compiling opencv_contrib

asked 2015-06-07 12:39:21 -0500

saihv gravatar image

updated 2015-06-07 12:52:20 -0500


I am trying to use the SIFT_create function from xfeatures2d in Python. Even after I download the opencv_contrib repo and build opencv 3.0 with the extra directories flag set, I am unable to use cv2.xfeatures2d in Python.

File "homography.py", line 12, in <module>
sift = cv2.xfeatures2d.SIFT_create()
AttributeError: 'module' object has no attribute 'xfeatures2d'

Is this a known issue? Any comments/suggestions about solving this would be very helpful. I am trying to stick to opencv 3.0 because the homography sample code makes use of drawMatches() function which is not present in the older versions. Thanks!

EDIT: Just confirming, cv2.__version__ returns 3.0.0.

cmake output:

 OpenCV modules:
--     To be built:                 hal core flann imgproc ml photo reg surface_matching video viz face imgcodecs shape videoio highgui objdetect optflow superres tracking ts xobjdetect xphoto adas bgsegm bioinspired features2d latentsvm line_descriptor saliency text calib3d ccalib datasets rgbd videostab xfeatures2d ximgproc stitching
edit retag flag offensive close merge delete