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試試吧