Update blob detection example

This commit is contained in:
iabdalkader 2014-03-02 01:47:20 +02:00
parent 1d62ec6101
commit ab05fb6213
2 changed files with 23 additions and 6 deletions

View File

@ -0,0 +1,23 @@
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))

View File

@ -1,6 +0,0 @@
from openmv import sensor, imlib
while (True):
image = sensor.snapshot()
r= imlib.detect_color(image, (340, 50, 50), 10)
imlib.draw_rectangle(image, r)