OpenCV AttributeError: 'module' object has no attribute 'xfeatures2d'

Question:

Currently using version OpenCV 3.3.0.

I could not use the SURF and SIFT functionalities. I need to install the xfeatures2d to access those missing functionalities.

Can anyone suggest me how to install those additional modules in opencv 3.3.0

I’m getting the following error

sift = cv2.xfeatures2d.SIFT()
AttributeError: 'module' object has no attribute 'xfeatures2d'
Asked By: Suresh K

||

Answers:

If you are working with Ubuntu, follow this link step by step and you shall have what you need. https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/

And for windows, follow this tutorial: https://youtu.be/MXqpHIMdKfU
Although I myself didn’t have much luck with the installation in windows.

And there is no shortcut to this, you will have to do the whole procedure to get sift and surf because it is located in the opencv contrib package which is not already present in opencv and has to be installed separately.

Answered By: KulaDamian

I have found the solution for my own problem.

Please use the following code to install additional module that you need for using opencv :

easy_install opencv-contrib-python

or

pip install opencv-contrib-python
Answered By: Suresh K
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.