From fb27f10471a82d9b7dde7f00cc631ec1ef2cda30 Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:37:34 +0100 Subject: [PATCH] Ensure we have enough width to handle images that compress weirdly. --- trafficlight/internals/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trafficlight/internals/client.py b/trafficlight/internals/client.py index 44c6b87..2007223 100644 --- a/trafficlight/internals/client.py +++ b/trafficlight/internals/client.py @@ -117,11 +117,11 @@ def video_image_colour(self) -> VideoImage: # We match the source 255 as "higher than 247" because the video codec reduces the detail on the exact hue. # These capture the expected values for the RED GREEN and BLUE images - if pixel[0] > 245 and pixel[1] < 10 and pixel[2] < 10 and pixel[3] == 255: + if pixel[0] > 213 and pixel[1] < 25 and pixel[2] < 25 and pixel[3] == 255: return VideoImage.RED - if pixel[0] < 10 and pixel[1] > 245 and pixel[2] < 10 and pixel[3] == 255: + if pixel[0] < 25 and pixel[1] > 213 and pixel[2] < 25 and pixel[3] == 255: return VideoImage.GREEN - if pixel[0] < 10 and pixel[1] == 0 and pixel[2] > 245 and pixel[3] == 255: + if pixel[0] < 25 and pixel[1] < 25 and pixel[2] > 213 and pixel[3] == 255: return VideoImage.BLUE # This captures video streams that have frozen on the initial state