Update keypoints example script.

This commit is contained in:
iabdalkader 2017-05-22 19:48:49 +02:00
parent e960546b6b
commit 05f5d07e99

View File

@ -42,13 +42,14 @@ while (True):
# keypoints from the first scale only, which will match one of the scales in the first descriptor. # keypoints from the first scale only, which will match one of the scales in the first descriptor.
kpts2 = img.find_keypoints(max_keypoints=150, threshold=10, normalized=True) kpts2 = img.find_keypoints(max_keypoints=150, threshold=10, normalized=True)
if (kpts2): if (kpts2):
c = image.match_descriptor(kpts1, kpts2, threshold=85) match = image.match_descriptor(kpts1, kpts2, threshold=85)
match = c[6] # C[6] contains the number of matches. if (match.count()>10):
if (match>10): # If we have at least n "good matches"
img.draw_rectangle(c[2:6]) # Draw bounding rectangle and cross.
img.draw_cross(c[0], c[1], size=10) img.draw_rectangle(match.rect())
img.draw_cross(match.cx(), match.cy(), size=10)
print(kpts2, "matched:%d dt:%d"%(match, c[7])) print(kpts2, "matched:%d dt:%d"%(match.count(), match.theta()))
# NOTE: uncomment if you want to draw the keypoints # NOTE: uncomment if you want to draw the keypoints
#img.draw_keypoints(kpts2, size=KEYPOINTS_SIZE, matched=True) #img.draw_keypoints(kpts2, size=KEYPOINTS_SIZE, matched=True)