opencv3计算机视觉python版本下的 图像检索遭遇python-contrib问题

opencv3计算机视觉–图像检索

anaconda3+pycharm+opencv3

‘module’ object has no attribute 'xfeatures2d’问题解决

在使用opencv3 计算机视觉这本书时,遇到了很多bug,书上代码手敲进去不断有问题,这次遇到的是opencv—contrib—python的安装错误,使得编译老失败,这里奉上解决办法,真实有效!!!

cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\sift.cpp:1207: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'cv::xfeatures2d::SIFT::create'

这是报错的原因,其实东西都装了,就是版本问题。
解决办法:
在conda的cmd下

pip install opencv-python==3.4.2.16
pip install opencv-contrib-python==3.4.2.16

要先删除原来的opencv-python和opencv-contrib-python
删除的命令是:pip uninstall opencv-python
不行的话就pip3试试吧

你可能感兴趣的:(opencv)