mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Fix blob example
This commit is contained in:
parent
264d06aa7b
commit
df5808b27d
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user