写for循环遍历一下:
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot().lens_corr(1.8)
max_circle = None
for c in img.find_circles(threshold = 2000, x_margin = 10, y_margin = 10, r_margin = 10,
r_min = 2, r_max = 100, r_step = 2):
if max_circle is None:
max_circle = c
elif c.r() > max_circle.r():
max_circle = c
print(max_circle)
if max_circle:
img.draw_circle(max_circle.x(), max_circle.y(), max_circle.r(), color = (255, 0, 0))
print("FPS %f" % clock.fps())