diff --git a/usr/examples/blob_detection.py b/usr/examples/blob_detection.py index 064cd0413..9fa9034e4 100644 --- a/usr/examples/blob_detection.py +++ b/usr/examples/blob_detection.py @@ -1,15 +1,20 @@ import sensor, imlib, time +sensor.set_pixformat(sensor.RGB565) clock = time.clock() while (True): + clock.tick() # take snapshot image = sensor.snapshot() # detect blobs - imlib.threshold(image, (255, 127, 127), 48) - clock.tick() + imlib.threshold(image, (255, 127, 127), 40) imlib.median(image, 3) blobs = imlib.count_blobs(image) - image = sensor.snapshot() + + # draw rectangles around detected blobs + image = sensor.snapshot() for r in blobs: - imlib.draw_rectangle(image, r) + imlib.draw_rectangle(image, r) + + print(clock.fps()) break