diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2023-06-06 13:53:10 +0200 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2023-06-06 13:53:10 +0200 |
commit | bdf59e4c3680987591bdf0234220922e5e41fc5a (patch) | |
tree | fe1b4a335c056a1b5c06d585d5654f9aa7664c40 /nicla/traffic_light.py | |
parent | 93c107718fd6e323fa2336db885b26721f241fa4 (diff) |
first integration
Diffstat (limited to 'nicla/traffic_light.py')
-rw-r--r-- | nicla/traffic_light.py | 9 |
1 files changed, 4 insertions, 5 deletions
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() |