人脸识别,求指教
-
SUB = "s2"
NUM_SUBJECTS = 5
NUM_SUBJECTS_IMGS = 10img = image.Image("I/wx.pgm"%(SUB)).mask_ellipse()
d0 = img.find_lbp((0, 0, img.width(), img.height()))
img = Noneprint("")
for s in range(1, NUM_SUBJECTS+1):
dist = 0
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(d0, d1)
print("Average dist for subject %d: %d"%(s, dist/NUM_SUBJECTS_IMGS))img = image.Image("I/wx.pgm"%(SUB)).mask_ellipse()
img = image.Image("orl_faces/s%d/%d.pgm"%(s, i)).mask_ellipse()
这两句代码我应该怎么改啊,老提示错误,求指教
-
你需要把完整的可运行的代码,以及错误提示都贴上来
-
@kidswong999 import sensor, time, image
SUB = "s2"
NUM_SUBJECTS = 5
NUM_SUBJECTS_IMGS = 10img = image.Image("orl_faces/%s/wx.jpg"%(SUB)).mask_ellipse()
d0 = img.find_lbp((0, 0, img.width(), img.height()))
img = Noneprint("")
for s in range(1, NUM_SUBJECTS+1):
dist = 0
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(d0, d1)
print("Average dist for subject %d: %d"%(s, dist/NUM_SUBJECTS_IMGS))
这是完整的代码
-
你需要把orl_faces文件夹放到SD卡里,参照教程。
-