Traffic Light Announcer

Controls
State: unknown

0%
50%
40%

ROI = top portion of the frame (your “current lane”). Adjust until it covers where the traffic light appears.

Color thresholds (HSV)

Tweak if lighting is tricky. We count pixels in the ROI whose HSV falls inside these ranges.

60
80
28
12

Red uses two hue bands near 0 and 180; yellow is around the center shown; green is roughly opposite yellow.

Smoothing

Upgrade path: Replace the color-based step with a detector (YOLO ONNX via onnxruntime-web) and then classify the crop or read class directly. Keep the ROI and announcement logic the same.