CODEDRAGON ㆍDevelopment/Python
에러메시지
AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d'
sift = cv2.xfeatures2d.SIFT_create() AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d' |
해결방법 1
패키지를 설치합니다.
pip install opencv-contrib-python
C:\CodeLab>pip install opencv-contrib-python Collecting opencv-contrib-python Downloading https://files.pythonhosted.org/packages/ba/0d/40121ed697f6105b9ffafc0e455e955ba8cbff2dda239cf188d24525be5b/opencv_contrib_python-4.1.1.26-cp36-cp36m-win_amd64.whl (45.4MB) |████████████████████████████████| 45.4MB 70kB/s Requirement already satisfied: numpy>=1.11.3 in c:\python\python36\lib\site-packages (from opencv-contrib-python) (1.14.4) Installing collected packages: opencv-contrib-python ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 액세스가 거부되 었습니다: 'C:\\Python\\Python36\\Lib\\site-packages\\cv2\\cv2.cp36-win_amd64.pyd' Consider using the `--user` option or check the permissions.
C:\CodeLab> |
C:\CodeLab>pip install opencv-contrib-python Collecting opencv-contrib-python Requirement already satisfied: numpy>=1.11.3 in c:\python\python36\lib\site-packages (from opencv-contrib-python) (1.14.4) Installing collected packages: opencv-contrib-python Successfully installed opencv-contrib-python-4.1.1.26
C:\CodeLab> |
permissions error 나서 실패 나는 경우 다시 실행하면 해결됩니다.
해결방법 2
pip uninstall opencv-contrib-python
pip uninstall opencv-python
pip install opencv-contrib-python
pip install opencv-python
https://pypi.org/project/opencv-contrib-python/
해결방법 3
설치 후 에 아래와 같이 에러가 발생한다면 아래 링크를 통해 조치하시기 바랍니다.
sift = cv2.xfeatures2d.SIFT_create() cv2.error: OpenCV(4.1.1) 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'
|
https://codedragon.tistory.com/9589
'Development > Python' 카테고리의 다른 글
XML vs CSV (0) | 2019.11.27 |
---|---|
GeoPandas (0) | 2019.11.26 |
scrapy - Scraping 파이썬 라이브러리 (0) | 2019.11.24 |
linspace() (0) | 2019.11.24 |
딥러닝 구동에 사용되는 고급 경사 하강법 개요 및 활용법 (0) | 2019.11.23 |