Opencv 3.0 - module object has no attribute 'xfeatures2d'

Pawan picture Pawan · Apr 18, 2015 · Viewed 13.2k times · Source

I have shifted from OpenCV 2.4.9 to 3.0 to make use of drawMatches and drawMatchesKnn function. I came to know that it does not come along with non-free algorithms like SIFT , SURF. So I installed opencv_contrib from https://github.com/Itseez/opencv_contrib by following steps

cmake -DOPENCV_EXTRA_MODULES_PATH=/home/zealous/Downloads/opencv_contrib-master/modules /usr/local ..

make -j5

make install

I also cross checked in modules of opencv, xfeatures2d was there. Then when I tried to do

>>> import cv2
>>> help(cv2.xfeatures2d)

It gives me following error

Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    help(cv2.xfeatures2d)
AttributeError: 'module' object has no attribute 'xfeatures2d'

What am I doing wrong here. Just FYI that I am using OpenCV 3.0 beta version . has OpenCV deactivated python wrappers for xfeatures2d or I have not installed it correct way?

Answer

Pawan picture Pawan · Sep 9, 2015

I am writing down an answer to my own question, as it might help somebody fixing the same issue.

The opencv package I was trying for was downloaded from opencv official website. I just downloaded latest code from github for opencv and installed it. It is working fine now with opencv-contrib.