logo

arduino该怎么读openmv传来的数据?

2019-08-21 13:29
J
zehg
import sensor, image, time
import json
from pyb import UART
sensor.reset()#重启摄像头
sensor.set_pixformat(sensor.RGB565) # grayscale is faster
#设置图像的大小
sensor.set_framesize(sensor.QQVGA)#表示拍摄画面的大小为160×120像素
#因为sensor参数设定之后, 图像质量不稳定, 要过一段时间。 跳过n张照片,在更改
#设置后,跳过一些帧,等待感光元件变稳定。这里是跳过2000毫秒
sensor.skip_frames(time = 2000)
clock = time.clock()
uart = UART(3, 115200)
while(True):
    clock.tick() #每次循环更新时钟
    img = sensor.snapshot().lens_corr(1.8)
    for c in img.find_circles(threshold = 2500, x_margin = 10, y_margin = 10, r_margin = 10,
            r_min = 2, r_max = 100, r_step = 2):
        img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
        
        output_str="%d"%(c.r()) 
        
        uart.write(output_str)
        
    print("you send:",output_str)
3a64532f-db62-424e-9704-d439cfb61158.png
2019-08-22 17:13
I
网红小智智 星瞳科技

https://book.openmv.cc/MCU/serial2.html