OpenCV库使用sift函数,出现“The function/feature is not implemented”问题解决方法

sift = cv2.xfeatures2d.SIFT_create(),提示如下错误:

cv2.error: OpenCV(4.1.0) 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'

 谷歌一下,发现是sift算法已经申请专利,开源OpenCV没有版权,新的OpenCV去掉了这个算法。

解决办法如下:

1、卸载已安装的高版本:

pip uninstall opencv-python
pip uninstall opencv-contrib-python

2、安装低版本

pip install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python==3.4.2.16
pip install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-contrib-python==3.4.2.16

至此,问题完美解决~~~


版权声明:本文为ctrigger原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。