openmv识别特征物体后,反馈坐标;但是Arduino怎么处理坐标?
2
2xvc_1545910308
@2xvc_1545910308
-1
声望
6
楼层
577
资料浏览
0
粉丝
0
关注
2xvc_1545910308 发布的帖子
-
代码段有错误,请问如何修改呀,请大佬们有时间指点一下,非常感谢?
Untitled - By: 16652 - 周五 1月 4 2019
import sensor, image, time
from pyb import UARTsensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
uart=UART(3,9600);clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot()
img = sensor.snapshot().lens_corr(1.8)circles = img.find_circles(threshold = 2000, x_margin = 10, y_margin = 10, r_margin = 10, r_min = 2, r_max = 100, r_step = 2) if circles: data=[] for c in circles: img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0)) data.append((c.x(),c.y())) data_out = json.dumps(set(data)) uart.write(data_out +'\n')
-
以下代码为矩形识别代码,如何反馈矩形的中心位置(坐标)具体是多少呀?
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster (160x120 max on OpenMV-M7)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()while(True):
clock.tick()
img = sensor.snapshot()# `threshold` below should be set to a high enough value to filter out noise # rectangles detected in the image which have low edge magnitudes. Rectangles # have larger edge magnitudes the larger and more contrasty they are... for r in img.find_rects(threshold = 10000): img.draw_rectangle(r.rect(), color = (255, 0, 0)) for p in r.corners(): img.draw_circle(p[0], p[1], 5, color = (0, 255, 0)) print(r) print("FPS %f" % clock.fps())
请在这里粘贴代码