def keypointToPoint(keypoint):
point = np.zeros(len(keypoint) * 2, np.float32)
for i in range(len(keypoint)):
point[i * 2] = keypoint[i].pt[0]
point[i * 2 + 1] = keypoint[i].pt[1]
point = point.reshape(-1, 2)
return point
参数说明:
keypoint为surf.detectAndCompute()函数的返回值,其中包含关键点位置信息
运行结果: