logo

openmv人脸识别不能在LCD显示屏扩展版上实时传输,很卡

2024-08-08 17:48
I
_6hpf

openmv人脸识别不能在LCD显示屏扩展版上实时传输,很卡


import sensor, time, image, display
sensor.reset()
sensor.set_contrast(3)
sensor.set_gainceiling(16)


sensor.set_framesize(sensor.QQVGA2)
sensor.set_pixformat(sensor.GRAYSCALE)
face_cascade = image.HaarCascade("frontalface", stages=25)
print(face_cascade)

# FPS clock
clock = time.clock()
lcd = display.SPIDisplay()  # Initialize the lcd screen.


while (True):
    clock.tick()

    # 拍摄一张照片
    img = sensor.snapshot()
    objects = img.find_features(face_cascade, threshold=0.75, scale=1.35)
  
    for r in objects:
        img.draw_rectangle(r)
        cx=r[0]+r[2]/2
        cy=r[1]+r[3]/2
        print('cx = %d, cy = %d' %(cx,cy))
        img.draw_cross(int(cx),int(cy))
        lcd.write(img) 
    
    print(clock.fps())
2024-08-08 19:24
I
网红小智智 星瞳科技

你缩进有问题。lcd.write(img) 不应该放在for循环里面。