|
|
@ -114,22 +114,21 @@ def ui_thread(addr): |
|
|
|
|
|
|
|
|
|
|
|
rgb_img_raw = vipc_client.recv() |
|
|
|
rgb_img_raw = vipc_client.recv() |
|
|
|
|
|
|
|
|
|
|
|
if rgb_img_raw is not None and rgb_img_raw.any(): |
|
|
|
if rgb_img_raw is None or not rgb_img_raw.any(): |
|
|
|
num_px = len(rgb_img_raw) // 3 |
|
|
|
continue |
|
|
|
imgff_shape = (vipc_client.height, vipc_client.width, 3) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if imgff is None or imgff.shape != imgff_shape: |
|
|
|
num_px = len(rgb_img_raw) // 3 |
|
|
|
imgff = np.zeros(imgff_shape, dtype=np.uint8) |
|
|
|
imgff_shape = (vipc_client.height, vipc_client.width, 3) |
|
|
|
|
|
|
|
|
|
|
|
imgff = np.frombuffer(rgb_img_raw, dtype=np.uint8).reshape((vipc_client.height, vipc_client.width, 3)) |
|
|
|
if imgff is None or imgff.shape != imgff_shape: |
|
|
|
imgff = imgff[:, :, ::-1] # Convert BGR to RGB |
|
|
|
imgff = np.zeros(imgff_shape, dtype=np.uint8) |
|
|
|
zoom_matrix = _BB_TO_FULL_FRAME[num_px] |
|
|
|
|
|
|
|
cv2.warpAffine(imgff, zoom_matrix[:2], (img.shape[1], img.shape[0]), dst=img, flags=cv2.WARP_INVERSE_MAP) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
intrinsic_matrix = _INTRINSICS[num_px] |
|
|
|
imgff = np.frombuffer(rgb_img_raw, dtype=np.uint8).reshape((vipc_client.height, vipc_client.width, 3)) |
|
|
|
else: |
|
|
|
imgff = imgff[:, :, ::-1] # Convert BGR to RGB |
|
|
|
img.fill(0) |
|
|
|
zoom_matrix = _BB_TO_FULL_FRAME[num_px] |
|
|
|
intrinsic_matrix = np.eye(3) |
|
|
|
cv2.warpAffine(imgff, zoom_matrix[:2], (img.shape[1], img.shape[0]), dst=img, flags=cv2.WARP_INVERSE_MAP) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
intrinsic_matrix = _INTRINSICS[num_px] |
|
|
|
|
|
|
|
|
|
|
|
sm.update(0) |
|
|
|
sm.update(0) |
|
|
|
|
|
|
|
|
|
|
|