def project_to_image(points_3d, proj_mat):
    points_shape = list(points_3d.shape)
    points_shape[(- 1)] = 1
    points_4 = np.concatenate([points_3d, np.ones(points_shape)], axis=(- 1))
    point_2d = (points_4 @ proj_mat.T)
    point_2d_res = (point_2d[..., :2] / point_2d[..., 2:3])
    return point_2d_res
def project_to_image(points_3d, proj_mat):
    points_shape = list(points_3d.shape)
    points_shape[(- 1)] = 1
    points_4 = np.concatenate([points_3d, np.ones(points_shape)], axis=(- 1))
    point_2d = (points_4 @ proj_mat.T)
    point_2d_res = (point_2d[..., :2] / point_2d[..., 2:3])
    return point_2d_res