Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
700 views
in Technique[技术] by (71.8m points)

python - xfeatures2d not found in OpenCV on Ubuntu

I am using OpenCV version 3.2.0 and xfeatures2d is not found on this. Is there any way I can install this to the same version of OpenCV?

>>> import cv2
>>> help(cv2.xfeatures2d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'xfeatures2d'
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I encountered the same problem. SURF and SIFT are not a part of the main repo module of OpenCV. Instead, they are available in opencv_contrib folder. The README file of opencv_contrib gives clear instructions on how to install the modules in opencv_contrib.

cd <opencv_build_directory>
cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
make -j5

Also note that if you are using OpenCV 3.2, these modules will be installed on Python3.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...