Camera_utils

packnet_sfm.geometry.camera_utils.construct_K(fx, fy, cx, cy, dtype=torch.float32, device=None)[source]

Construct a [3,3] camera intrinsics from pinhole parameters

packnet_sfm.geometry.camera_utils.scale_intrinsics(K, x_scale, y_scale)[source]

Scale intrinsics given x_scale and y_scale factors

packnet_sfm.geometry.camera_utils.view_synthesis(ref_image, depth, ref_cam, cam, mode='bilinear', padding_mode='zeros')[source]

Synthesize an image from another plus a depth map.

Parameters
  • ref_image (torch.Tensor [B,3,H,W]) – Reference image to be warped

  • depth (torch.Tensor [B,1,H,W]) – Depth map from the original image

  • ref_cam (Camera) – Camera class for the reference image

  • cam (Camera) – Camera class for the original image

  • mode (str) – Interpolation mode

  • padding_mode (str) – Padding mode for interpolation

Returns

ref_warped – Warped reference image in the original frame of reference

Return type

torch.Tensor [B,3,H,W]