snapshot: fix rgb overflow (#24963)

clamp rgb
pull/24970/head
Maxime Desroches 3 years ago committed by GitHub
parent de0c12e5af
commit 240c44e50c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      system/camerad/snapshot/snapshot.py

@ -39,7 +39,7 @@ def yuv_to_rgb(y, u, v):
[0.00000, -0.39465, 2.03211], [0.00000, -0.39465, 2.03211],
[1.13983, -0.58060, 0.00000], [1.13983, -0.58060, 0.00000],
]) ])
rgb = np.dot(yuv, m) rgb = np.dot(yuv, m).clip(0, 255)
return rgb.astype(np.uint8) return rgb.astype(np.uint8)

Loading…
Cancel
Save