算是SIFT算法的改进算法。
import cv2
imgpath = '5.jpg'
img = cv2.imread(imgpath)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
surf = cv2.xfeatures2d.SURF_create(5000)
keypoints, descriptor = surf.detectAndCompute(gray, None)
img = cv2.drawKeypoints(image=img, outImage=img, keypoints=keypoints, flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS,
color=(51, 163, 236))
cv2.imshow('IMAGE', img)
cv2.imwrite('SURF.png', img)
while True:
if cv2.waitKey() & 0xff == ord('q'):
break
cv2.destroyAllWindows()