mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
24 lines
547 B
Python
24 lines
547 B
Python
from openmv import sensor, imlib
|
|
total_frames = 0
|
|
total_ticks = 0
|
|
while (True):
|
|
# take snapshot
|
|
image = sensor.snapshot()
|
|
t_start = ticks()
|
|
|
|
# detect blobs
|
|
imlib.threshold(image, (255, 127, 127), 38)
|
|
imlib.median(image, 1)
|
|
blobs = imlib.count_blobs(image)
|
|
|
|
total_ticks = total_ticks + (ticks()-t_start)
|
|
total_frames = total_frames + 1
|
|
|
|
# take new snapshot
|
|
image = sensor.snapshot()
|
|
for r in blobs:
|
|
imlib.draw_rectangle(image, r)
|
|
|
|
print (total_ticks/total_frames)
|
|
print (len(blobs))
|