openmv在识别色块中为什么一直出现这种错误
-
import sensor, image, time line_threshold = (2, 51, -21, 65, -17, 18) sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(10) sensor.set_auto_whitebal(False) clock = time.clock() def find_max(blobs): max_size=0 for blob in blobs: if blob[2]*blob[3] > max_size: max_blob=blob max_size = blob[2]*blob[3] return max_blob while(True): clock.tick() img = sensor.snapshot() blobs = img.find_blobs([line_threshold], x_stride=10) if blobs: max_blob=find_max(blobs) if int(max_blob.w()/max_blob.h())>5 and max_blob.w()>200: img.draw_rectangle(max_blob[0:4]) img.draw_cross(max_blob[5], max_blob[6]) print(max_blob[5], max_blob[6]) print(clock.fps())
-
-
sensor.set_framesize(sensor.QVGA)
改为
sensor.set_framesize(sensor.QQVGA)