颜色过去以后会出现好几遍这个颜色,能不能只出现一次
-
颜色过去以后会出现好几遍这个颜色,能不能只出现一次
import sensor, image,time,pyb,utime import sensor, image, time,utime from pyb import UART uart = UART(3, 57600) output_str=0 yanse=0 flag=1 while 1: if uart.any(): flag=uart.readline().decode() flag=int(flag) print(flag) if flag==1: thresholds = [(60, 18, 37, 75, -35, 76),(58, 24, -11, 17, -61, -16),(60, 30, -17, -58, -43, 31)] sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) sensor.set_auto_whitebal(False) while flag : img = sensor.snapshot() blobs=img.find_blobs(thresholds, pixels_threshold=5000, area_threshold=400) for blob in blobs: img.draw_rectangle(blob.rect()) img.draw_cross(blob.cx(), blob.cy()) yanse="%s" % (blob.code()) print( yanse) if yanse: uart.write(yanse) yanse=0
-
现在是会出现好几个1好几个2好几个4但是我只想要一个124,就是这个红色会识别很多次绿色会识别很多次,蓝色会识别很多次
-
https://forum.singtown.com/topic/1735/如何识别三种颜色-而且能够分别记下坐标
你应该分别调用find_blobs