INNER CODE UNIT · Python
cam_points_b3hw
nianticlabs/simplerecon · losses.py:108
cam_points_b3hw = src_cam_points_b3N.view(-1, 3, depth_height, depth_width)
pix_coords_b2hw = cam_points_b3hw[:, :2]
proj_src_depths_b1hw = cam_points_b3hw[:, 2:]
uv_coords = (pix_coords_b2hw.permute(0, 2, 3, 1)
/ torch.tensor(
[depth_width, depth_height]
).view(1, 1, 1, 2).type_as(pix_coords_b2hw)
)
uv_coords = 2 * uv_coords - 1
src_depth_sampled_b1hw = F.grid_sample(
input=src_depth_b1hw,
grid=uv_coords,
padding_mode='zeros',
mode='nearest',
align_corners=False,
)