I was using find_rects and it was working well but all of a sudden it seems to broken.
See this output - YouTube
From this simple test script
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
white_threshold = (60, 100, -128, 127, -128, 127)
while True:
clock.tick()
img = sensor.snapshot()
img.binary([white_threshold])
for r in img.find_rects(threshold = 5000):
img.draw_circle(r.x()+r.w()//2, r.y()+r.h()//2, r.w()//2, color = (0, 255, 0))
print("FPS %f" % clock.fps())