Ask Your Question

Revision history [back]

Follow the steps (for windows):

1) you need ensure that xfeatures2d is a valid opencv module (on building), see: https://wiki.qt.io/Show_library_dependencies;

2) you need ensure that PYTHONPATH is setted for cv2.dll or cv2.so directory;

> echo %PYTHONPATH%

or see https://www.computerhope.com/issues/ch000549.htm.

In my case, cv2.dll is in C:\libs:

> set PYTHONPATH=C:\libs
> python
Python 2.7.10 (default, Jul 30 2016, 19:40:32) 
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.xfeatures2d
<module 'cv2.xfeatures2d' (built-in)>
>>>