登录后复制 # -*- coding: utf-8 -*- import sysimport cv2 import numpy as np# 加载数据 input_file = 'table.jpg' #sys.argv[1] img = cv2.imread(input_file) img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # 提取关键点 sift = cv2.xfeatures2d.SIFT_create() keypoints = sift.detect(img_gray, None) # 画出特征点 img_sift = np.copy(img) cv2.drawKeypoints(img, keypoints, img_sift, flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS) # 展示 cv2.imshow('Input image', img) cv2.imshow('SIFT features', img_sift) cv2.waitKey() 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16. 原创作者: u_15862653 转载于: https://blog.51cto.com/u_15862653/11888518