python3.6 opencv3.4.3使用surf特征出错【解决方案】

python3.6 opencv3.4.3使用surf特征出错【解决方案】

surf = cv2.xfeatures2d.SURF_create()
cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\surt.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::SURF::create’

解决方案:卸载掉原先的opencv contrib 包。pip uninstall opencv-python 或者 pip uninstall opencv-contrib-python,然后pip install opencv-contrib-python==3.4.1.15

原因:opencv-contrib-python3.4.3版本申请了算法专利保护,SIFT等已经不能够使用。

你可能感兴趣的:(python+opencv)