Skip to content

Commit

Permalink
Ensure we have enough width to handle images that compress weirdly.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkaye committed Aug 30, 2023
1 parent 792dd7e commit fb27f10
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions trafficlight/internals/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fb27f10

Please sign in to comment.