Files
sunnypilot/selfdrive/camerad/test/yuv_bench/cnv.py
T
Willem Melching 2ac27def5a Running pre-commit in CI (#1590)
* Running pre-commit in CI

* fix dockerfile syntax

* dont run on submodule repo folders

* Fix some import errors in ci

* more stuff

* That should be the last one
old-commit-hash: ba2ac1207a
2020-05-28 15:40:48 -07:00

20 lines
474 B
Python

import numpy as np
import cv2 # pylint: disable=import-error
# img_bgr = np.zeros((874, 1164, 3), dtype=np.uint8)
# for y in range(874):
# for k in range(1164*3):
# img_bgr[y, k//3, k%3] = k ^ y
# cv2.imwrite("img_rgb.png", img_bgr)
cl = np.fromstring(open("out_cl.bin", "rb").read(), dtype=np.uint8)
cl_r = cl.reshape(874 * 3 // 2, -1)
cv2.imwrite("out_y.png", cl_r[:874])
cl_bgr = cv2.cvtColor(cl_r, cv2.COLOR_YUV2BGR_I420)
cv2.imwrite("out_cl.png", cl_bgr)