还用定时器为什么会出现内存错误的这种情况啊?
-
sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE sensor.set_framesize(sensor.B128X128) # or sensor.QQVGA (or others) sensor.set_windowing((92,112)) sensor.skip_frames(10) # Let new settings take affect. sensor.skip_frames(time = 5000) #等待5s face_cascade = image.HaarCascade("frontalface",stages=25 ) NUM_SUBJECTS = 3 #图像库中不同人数,一共6人 NUM_SUBJECTS_IMGS = 3 #每人有20张样本图片 flag=0 def tick(timer): # we will receive the timer object when being called flag=1 for s in range(1,NUM_SUBJECTS+1): dist=0 for i in range(1,NUM_SUBJECTS_IMGS+1): img1=image.Image("/photos/s%d/%d.pgm"%(s,i)) d1 = img.find_lbp((0, 0, img.width(), img.height())) dist += image.match_descriptor(d0, d1)#计算d0 d1即样本图像与被检测人脸的特征差异度。 print("Average dist for subject %d: %d"%(s, dist/NUM_SUBJECTS_IMGS)) pmin = min(pmin, dist/NUM_SUBJECTS_IMGS, s)#特征差异度越小,被检测人脸与此样本更相似更匹配。 print("差异度为:%d"%pmin) print("Timer callback") while (True): if flag==0: img=sensor.snapshot() objects = img.find_features(face_cascade, threshold=0.75, scale=1.35) for r in objects: img.draw_rectangle(r) d0=img.find_lbp(r) if (len(objects)!=0): tim = Timer(4, freq=1) # create a timer object using timer 4 - trigger at 1Hz tim.callback(tick) # set the callback to our tick function
-
请详细描述问题,
包括,目的,步骤,报错提示
-
@kidswong999 我想用定时器实现到当采集到人脸信息时调用程序,去对比两张图片的LBP值,然后输出最匹配的那个人。但是出现了内存错误的提示
-
这不是内存错误,你看看英文?
-
@kidswong999 刚才是这个我重启了一下程上面那个了