logo

这个是识别蓝色色环的代码,但这个阈值却也能识别绿色色环和红色色环,而我识别其他颜色的色环就不会出现这样的问题

2024-10-14 23:08
6
gh45

global flag

global send_num

if a=="r":

img = sensor.snapshot()

img.binary([ring_thresholds[0]])

img.dilate(1)

for blob in img.find_blobs(graythreshold,area_threshold=7000, pixels_threshold=100, area_threshold=2000, merge=True):

img.draw_rectangle(blob.rect())

img.draw_cross(blob.cx(), blob.cy())

print("red:(",blob.cx(),",",blob.cy(),")")

if blob.area() >5000 :

print("RED")

2024-10-22 20:00
I
网红小智智 星瞳科技

代码需要完整的,不然我没办法运行测试。

2024-11-01 01:23
6
gh45

找到原因了,和光线有关,颜色有时候容易错分