安装 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()
>>>

opencv-py 中使用 sift

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()

opencv-py 中使用 sift

相关文章: