reproject_depth_map#

deltacamera.reproject_depth_map(depth_map, old_camera, new_camera, output_imshape=None, interp=cv2.INTER_NEAREST, antialias_factor=1, cache_maps=False, precomp_undist_maps=True, return_validity_mask=False)[source]#

Reproject a depth map from old_camera to new_camera.

Unlike color images, depth values change under rotation because the camera’s Z-axis rotates. Each pixel’s depth is adjusted by the Z-component of the rotated ray direction.

Invalid pixels (outside the old image or behind the new camera) are set to NaN.

When antialias_factor > 1, the depth is rendered at higher resolution and then block-downsampled with nanmedian (NaN-safe).

Parameters:
  • depth_map (ndarray) – Input depth map (float32), where values are Z in old camera space.

  • old_camera (Camera) – The camera that captured depth_map.

  • new_camera (Camera) – The target camera.

  • output_imshape (tuple) – Deprecated. Use new_camera.copy(image_shape=…) instead.

  • interp (int) – OpenCV interpolation mode. Default: cv2.INTER_NEAREST.

  • antialias_factor (int) – Supersample factor. Depth is rendered at this multiple of the output resolution, then block-downsampled with nanmedian.

  • cache_maps (bool) – Whether to cache coordinate maps.

  • precomp_undist_maps (bool) – Whether to precompute undistortion maps.

  • return_validity_mask (bool) – If True, also return the validity mask.

Returns:

The reprojected depth map (float32, NaN for invalid pixels), or a tuple of (depth_map, validity_mask) if return_validity_mask is True.

Return type:

ndarray