(1)在调用sift = cv2.xfeatures2d.SIFT_create()
出现下面报错:
raceback (most recent call last):
File "
cv2.error: OpenCV(4.0.1) ../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 'create'
(2)原因:sift算法的专利问题,部分opencv版本的Sift/Surf算法无法使用
(3)解决办法:
卸载当前opencv-python和opencv-contrib-python第三方包
conda list 命令查看是否有opencv-python和opencv-contrib-python:
pip install opencv-python==3.4.2.17
pip install opencv-contrib-python==3.4.2.17
安装完成: