Update scripts that use descriptor functions.

This commit is contained in:
iabdalkader 2017-01-14 01:23:23 +02:00
parent bba8e5a9e0
commit be300ff6ed
5 changed files with 7 additions and 7 deletions

View File

@ -21,5 +21,5 @@ for s in range(1, NUM_SUBJECTS+1):
for i in range(2, NUM_SUBJECTS_IMGS+1):
img = image.Image("orl_faces/s%d/%d.pgm"%(s, i)).mask_ellipse()
d1 = img.find_lbp((0, 0, img.width(), img.height()))
dist += image.match_descriptor(image.LBP, d0, d1)
dist += image.match_descriptor(d0, d1)
print("Average dist for subject %d: %d"%(s, dist/NUM_SUBJECTS_IMGS))

View File

@ -61,7 +61,7 @@ while (True):
if (kpts2):
# Match the first set of keypoints with the second one
c=image.match_descriptor(image.ORB, kpts1, kpts2)
c=image.match_descriptor(kpts1, kpts2)
match = c[6] # C[6] contains the number of matches.
if (match>5):
img.draw_rectangle(c[2:6])

View File

@ -24,7 +24,7 @@ def draw_keypoints(img, kpts):
kpts1 = None
# NOTE: uncomment to load a keypoints descriptor from file
#kpts1 = image.load_descriptor(image.ORB, "/desc.orb")
#kpts1 = image.load_descriptor("/desc.orb")
#img = sensor.snapshot()
#draw_keypoints(img, kpts1)
@ -39,7 +39,7 @@ while (True):
kpts1 = kpts2
draw_keypoints(img, kpts1)
elif kpts2:
c = image.match_descriptor(image.ORB, kpts1, kpts2, threshold=85)
c = image.match_descriptor(kpts1, kpts2, threshold=85)
match = c[6] # C[6] contains the number of matches.
if (match>5):
img.draw_rectangle(c[2:6])

View File

@ -23,7 +23,7 @@ img = sensor.snapshot()
# NOTE: See the docs for other arguments
kpts = img.find_keypoints(scale_factor=1.2)
image.save_descriptor(image.ORB, "/%s.orb"%(FILE_NAME), kpts)
image.save_descriptor(kpts, "/%s.orb"%(FILE_NAME))
img.save("/%s.pgm"%(FILE_NAME))
img.draw_keypoints(kpts)

View File

@ -31,7 +31,7 @@ for i in range(0, 30):
img.draw_string(0, 0, "Please wait...")
d0 = None
#d0 = image.load_descriptor(image.LBP, "/desc.lbp")
#d0 = image.load_descriptor("/desc.lbp")
clock = time.clock()
while (True):
@ -45,7 +45,7 @@ while (True):
if (d0 == None):
d0 = d1
else:
dist = image.match_descriptor(image.LBP, d0, d1)
dist = image.match_descriptor(d0, d1)
img.draw_string(0, 10, "Match %d%%"%(dist))
img.draw_rectangle(face)