版本区别3.0
orb = cv2.ORB()
kp = orb.detect(img,None)
如果再3.4运行就会出现TypeError: Incorrect type of self (must be 'Feature2D' or its derivative)
opencv3.4函数有所变化
orb = cv2.ORB_create()
kp = orb.detect(img,None)
版本函数细微变化记录下来
import cv2 import numpy as np from matplotlib import pyplot as plt img = cv2.imread('left08.jpg',0) cv2.imshow("contours", img) orb = cv2.ORB_create() kp = orb.detect(img,None) kp,des =orb.compute(img,kp) img2 = cv2.drawKeypoints(img, kp, None, color=(0,255,0), flags=0) plt.imshow(img2),plt.show() # star = cv2.AgastFeatureDetector_create("STAR") cv2.waitKey(0) cv2.destroyAllWindows()