找到原因了,和光线有关,颜色有时候容易错分
G
gh45
@gh45
0
声望
4
楼层
175
资料浏览
0
粉丝
0
关注
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")