From bdf59e4c3680987591bdf0234220922e5e41fc5a Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Tue, 6 Jun 2023 13:53:10 +0200 Subject: first integration --- nicla/traffic_light.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'nicla/traffic_light.py') diff --git a/nicla/traffic_light.py b/nicla/traffic_light.py index 3d81139..517e2c3 100644 --- a/nicla/traffic_light.py +++ b/nicla/traffic_light.py @@ -30,11 +30,9 @@ def rgb2hsv(rgb): h = (h/6.0) % 1.0 return (h, s, v) -while(True): - clock.tick() - img = sensor.snapshot() - ## todo: downsample img - original = img.copy(copy_to_fb=True) + +def traf_lights(img) + original = img.copy() img = img.to_grayscale() for blob in img.find_blobs([(0, 60)], pixels_threshold=100): aspect = blob.h() / blob.w() @@ -63,3 +61,4 @@ while(True): img.draw_rectangle(blob.rect()) img.draw_circle(lights[light_status-1][0], lights[light_status-1][1], 2) print(("", "rood", "geel", "groen")[light_status]) + sensor.dealloc_extra_fb() -- cgit v1.2.3