OPENMV卡顿非常严重
-
在执行程序的时候(未脱机),摄像头画面的卡顿非常的严重,画面的传输甚至达到接近一秒才一帧,下面是我的测试程序,麻烦大家看一看究竟是哪里出了问题(该程序所执行的功能仅仅只是全部的一部分,没法再缩减,甚至在实际执行的时候还需要添加)
import time from pyb import UART from pyb import LED import sensor, image sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) # can be QVGA on M7... sensor.skip_frames(30) sensor.set_auto_gain(False) # must turn this off to prevent image washout... uart = UART(3, 19200) BLUE = LED(3) RED = LED(1) GREEN = LED(2) def led_blink(BLUE): BLUE.on() def led_blink(GREEN): GREEN.on() def led_blink(RED): RED.on() while(True): img = sensor.snapshot() img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens. for code in img.find_qrcodes(): data = code.payload() print(data) if(data=='123'): uart.write('123') time.sleep(100) else: if(data=='213'): uart.write('213') time.sleep(100) else: print('NONE') uart.any() jieshou = uart.read(1) if(jieshou==b'1'): led_blink(BLUE) print(123)
-
妈耶。。。。居然找到了解决办法:
if uart.any():
uart.readchar()
就是这个神奇的语句,我的整个程序变得无比的柔顺丝滑,辛苦各位,在下告辞~