def camera_to_lidar(points, r_rect, velo2cam):
    points_shape = list(points.shape[0:(- 1)])
    if (points.shape[(- 1)] == 3):
        points = np.concatenate([points, np.ones((points_shape + [1]))], axis=(- 1))
    lidar_points = (points @ np.linalg.inv((r_rect @ velo2cam).T))
    return lidar_points[..., :3]
def camera_to_lidar(points, r_rect, velo2cam):
    points_shape = list(points.shape[0:(- 1)])
    if (points.shape[(- 1)] == 3):
        points = np.concatenate([points, np.ones((points_shape + [1]))], axis=(- 1))
    lidar_points = (points @ np.linalg.inv((r_rect @ velo2cam).T))
    return lidar_points[..., :3]