pytorch3d icon indicating copy to clipboard operation
pytorch3d copied to clipboard

Camera Coordinate Conversion Guide

Open nath-partha opened this issue 7 months ago • 0 comments

❓ is there a guidebook or tool that helps in converting the parameters of opencv cameras to pytorch3d cameras

pytorch3d.utils.cameras_from_opencv_projection is useful but its for for the PerspectiveCameras class only

im trying to convert for the fisheye cameras

it would help if there was materials detailing what transformations need to be carried out on {R, T, K}_cv2 to convert to {R,T,K}_p3d

such that Image

gives a 1:1 correspondance in image rendering and points projection when

        p3d_k = calc_pytorch3d_camera_matrix(intrinsic_matrices)
        p3d_p = calc_pytorch3d_camera_pose(P_batched)
        batched_cameras = FishEyeCameras(
            focal_length=p3d_k[..., 0, 0],
            image_size=torch.tensor([[scaled_height,
                                      scaled_width]]).repeat(batch_size, 1),
            principal_point=p3d_k[..., :2, 2],
            radial_params=torch.tensor([[0]]).repeat(batch_size, 1),
            tangential_params=torch.tensor([[d, e]]).repeat(batch_size, 1),
            thin_prism_params=torch.tensor(
                ((0.0, 0.0, 0.0, 0.0), )).repeat(batch_size, 1),
            R=p3d_p[..., :3, :3],
            T=p3d_p[..., :3, 3],
        )

i would then setup the necessary implementation in the functions used to create p3d_k and p3d_p

open to any other suggestion for handling the parameters transform for this use case.

TIA

nath-partha avatar May 07 '25 16:05 nath-partha