使用cv2 ,应用cv2.xfeatures2d.SIFT_create() 函数时,提示
cv2.error: OpenCV(4.0.0) /Users/travis/build/skvark/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 'create'
经过一番查找,发现
xfeatures2d是付费内容,而我“pip3 install opencv_contrib_python”安装的版本为最新版本,4.0
付费内容,更换一下低版本可用
pip3 install opencv-contrib-python==3.4.2.17
完美解决
前提是:python 3.7版本(Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43)),其他版本无兼容的opencv-contrib-python 3.4可用(踩坑python3.5版本)
上图纪念一下