pull/2047/head
ZwX1616 5 years ago
parent 171b4f5e00
commit 0a0f413972
  1. 13
      selfdrive/camerad/test/tici_zclient/livergb.py

@ -3,7 +3,10 @@ import numpy as np
import cv2 import cv2
from time import time, sleep from time import time, sleep
H, W = (604, 964) H, W = (604//3, 964//3)
# H, W = (604, 964)
cam_bufs = np.zeros((3,H,W,3), dtype=np.uint8)
if __name__ == '__main__': if __name__ == '__main__':
import zmq import zmq
@ -18,11 +21,13 @@ if __name__ == '__main__':
message = b"123" message = b"123"
dat = np.frombuffer(message, dtype=np.uint8) dat = np.frombuffer(message, dtype=np.uint8)
cam_id = dat[0]
# import pdb; pdb.set_trace()
b = dat[::3].reshape(H, W) b = dat[::3].reshape(H, W)
g = dat[1::3].reshape(H, W) g = dat[1::3].reshape(H, W)
r = dat[2::3].reshape(H, W) r = dat[2::3].reshape(H, W)
rgb = cv2.merge((r, g, b)) cam_bufs[cam_id] = cv2.merge((r, g, b))
rgb = cv2.cvtColor(rgb, cv2.COLOR_RGB2BGR) cam_bufs[cam_id]= cv2.cvtColor(cam_bufs[cam_id], cv2.COLOR_RGB2BGR)
cv2.imshow('RGB',rgb) cv2.imshow('RGB',cam_bufs.reshape((3*H,W,3)))
cv2.waitKey(20) cv2.waitKey(20)
dat.tofile('/tmp/c3rgb.img') dat.tofile('/tmp/c3rgb.img')
Loading…
Cancel
Save