from pyb import UART
import json
white_threshold = ( 40, 99, -6, 17, -11, 16)
red_threshold = ( 32, 55, 30, 64, 8, 38)
self_threshold = ( 60, 78, 20, 47, 10, 45)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(10)
sensor.set_auto_whitebal(False)
clock = time.clock()
uart = UART(3, 115200)
def find_max(blobs):
max_size=10
for blob in blobs:
if blob.pixels() > max_size:
max_blob=blob
max_size = blob.pixels()
return max_blob
while(True):
img = sensor.snapshot()
blobs = img.find_blobs([white_threshold])
output_str = json.dumps(blobs)
if blobs:
for b in blobs:
img.draw_rectangle(b[0:4])
img.draw_cross(b[5], b[6])
max_blob=find_max(blobs)我没看懂你具体要做什么。。。
我也没看懂你的代码要做什么。。。