import cv2
import numpy as np
img = cv2.imread('./image/dog.png')
gray =cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#创建ORB对象
orb = cv2.ORB_create( )
#进行检测
kp = orb.detect(gray)
#检测关键点,并计算描述子
kp, des = orb.compute(img, kp)
#或者一步到位,把关键点和描述子一起检测出来.
kp, des = orb.detectAndCompute(img,None)
#绘制关键点
cv2.drawKeypoints(gray, kp, img)
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()