安装 opencv-contrib-python==3.4.0.14:
(py36) >>> pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-contrib-python==3.4.0.14
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting opencv-contrib-python==3.4.0.14
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/aa/3d/e49c60fce8922dc933ad8302dc7a4f67b6716f88565be7fcfd71834e88d7/opencv_contrib_python-3.4.0.14-cp36-cp36m-win_amd64.whl (38.9MB)
100% |████████████████████████████████| 38.9MB 358kB/s
Requirement already satisfied: numpy>=1.11.3 in d:\programfilesnospace\miniconda3\envs\py36\lib\site-packages (from opencv-contrib-python==3.4.0.14) (1.16.2)
Installing collected packages: opencv-contrib-python
Successfully installed opencv-contrib-python-3.4.0.14
(py36) >>> python
Python 3.6.8 |Anaconda, Inc.| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> sift = cv2.xfeatures2d.SIFT_create()
>>>
清华源失效了
pip install opencv-contrib-python==3.4.0.14 -i https://pypi.mirrors.ustc.edu.cn/simple/

import cv2 as cv
img = cv.imread('../data/home.jpg')
gray= cv.cvtColor(img,cv.COLOR_BGR2GRAY)
sift = cv.xfeatures2d.SIFT_create()
kp = sift.detect(gray,None)
img=cv.drawKeypoints(gray,kp,img)
cv.imshow("SIFT", img)
cv.imwrite('sift_keypoints.jpg',img)
cv.waitKey(0)
cv.destroyAllWindows()


本文详细介绍了如何在Python环境中安装特定版本的OpenCV库,即opencv-contrib-python==3.4.0.14,并展示了如何利用该库进行图像处理,包括读取图像、转换颜色空间、使用SIFT算法检测关键点并绘制结果。
1629

被折叠的 条评论
为什么被折叠?



