颜色识别 索引问题 超出索引
-
为什么我这样索引会有错误呢?我已经赋值给他了 不是应该跟blob的数值相等吗?
threshold_index = 0 # 0 for red, 1 for green, 2 for blue foxiang=0 shuihu=0 dingshuji=0 # Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max) # The below thresholds track in general red/green/blue things. You may wish to tune them... thresholds = [(100, 20, -122, 127, -128, 127), # 黑色阈值 (34, 58, -128, 127, 32, 127), # 佛像阈值 (7, 58, 15, 38, -30, 11)] #紫色水壶阈值 sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_whitebal(False) # must be turned off for color tracking clock = time.clock() while(True): clock.tick() img = sensor.snapshot() foxiang=img.find_blobs([thresholds[1]]) if foxiang: print("坐标为",foxiang[5]) print(clock.fps())
-
https://book.openmv.cc/image/blob.html#blobs是一个列表
find_blobs返回的是多个色块。