使用opencv進行圖片特徵提取和描述的過程中需要使用:
cv2.xfeatures2d_SIFT.create()
來提取圖片的特徵點,但是顯示:module 'cv2.cv2' has no attribute 'xfeatures2d'
首先卸載opencv-python包
然後安裝:opencv-contrib-python
sudo pip install opencv-contrib-python == 3.4.2.16
另外如果不卸載opencv-python將會出現:
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’
已入坑請避雷走。