ravens/utils.py
def unproject_depth_vectorized(im_depth: np.ndarray, depth_dist: np.ndarray,
                               camera_mtx: np.ndarray,
                               camera_dist: np.ndarray) -> np.ndarray:
  """Unproject depth image into 3D point cloud, using calibration.

  Args:
    im_depth: raw depth image, pre-calibration of shape (height, width).
    depth_dist: depth distortion parameters of shape (8,)
    camera_mtx: intrinsics matrix of shape (3, 3). This is typically the return
      value of intrinsics_to_matrix.
    camera_dist: camera distortion parameters shape (5,).

  Returns:
    numpy array of shape [3, H*W]. each column is xyz coordinates
  """
  h, w = im_depth.shape

  # shape of each u_map, v_map is [H, W].
  u_map, v_map = np.meshgrid(np.linspace(0, w - 1, w), np.linspace(0, h - 1, h))

  adjusted_depth = depth_dist[0] + im_depth * depth_dist[1]

  # shape after stack is [N, 2], where N = H * W.
  uv_coordinates = np.stack((u_map.reshape(-1), v_map.reshape(-1)), axis=-1)

  return unproject_vectorized(uv_coordinates, adjusted_depth.reshape(-1),
                              camera_mtx, camera_dist)
Unproject depth image into 3D point cloud, using calibration.

  Args:
    im_depth: raw depth image, pre-calibration of shape (height, width).
    depth_dist: depth distortion parameters of shape (8,)
    camera_mtx: intrinsics matrix of shape (3, 3). This is typically the return
      value of intrinsics_to_matrix.
    camera_dist: camera distortion parameters shape (5,).

  Returns:
    numpy array of shape [3, H*W]. each column is xyz coordinates
  
Unproject depth image into 3D point cloud, using calibration.
Unproject depth image into 3D point cloud using calibration .
def unproject_depth_vectorized(im_depth: np.ndarray, depth_dist: np.ndarray,
                               camera_mtx: np.ndarray,
                               camera_dist: np.ndarray) -> np.ndarray:
  h, w = im_depth.shape
  u_map, v_map = np.meshgrid(np.linspace(0, w - 1, w), np.linspace(0, h - 1, h))
  adjusted_depth = depth_dist[0] + im_depth * depth_dist[1]
  uv_coordinates = np.stack((u_map.reshape(-1), v_map.reshape(-1)), axis=-1)
  return unproject_vectorized(uv_coordinates, adjusted_depth.reshape(-1),
                              camera_mtx, camera_dist)
def unproject_depth_vectorized ( im_depth : np . ndarray , depth_dist : np . ndarray , camera_mtx : np . ndarray , camera_dist : np . ndarray ) -> np . ndarray : h , w = im_depth . shape u_map , v_map = np . meshgrid ( np . linspace ( 0 , w - 1 , w ) , np . linspace ( 0 , h - 1 , h ) ) adjusted_depth = depth_dist [ 0 ] + im_depth * depth_dist [ 1 ] uv_coordinates = np . stack ( ( u_map . reshape ( - 1 ) , v_map . reshape ( - 1 ) ) , axis = - 1 ) return unproject_vectorized ( uv_coordinates , adjusted_depth . reshape ( - 1 ) , camera_mtx , camera_dist )
Unproject depth image into 3D point cloud, using calibration.
Unproject depth image into 3D point cloud using calibration .
"""Unproject depth image into 3D point cloud, using calibration.

  Args:
    im_depth: raw depth image, pre-calibration of shape (height, width).
    depth_dist: depth distortion parameters of shape (8,)
    camera_mtx: intrinsics matrix of shape (3, 3). This is typically the return
      value of intrinsics_to_matrix.
    camera_dist: camera distortion parameters shape (5,).

  Returns:
    numpy array of shape [3, H*W]. each column is xyz coordinates
  """ # shape of each u_map, v_map is [H, W]. # shape after stack is [N, 2], where N = H * W.
numpy array of shape [3, H*W]. each column is xyz coordinates
numpy array of shape [ 3 H * W ] . each column is xyz coordinates
im_depth
np.ndarray
raw depth image, pre-calibration of shape (height, width).
raw depth image pre - calibration of shape ( height width ) .
depth_dist
np.ndarray
depth distortion parameters of shape (8,)
depth distortion parameters of shape ( 8 )
camera_mtx
np.ndarray
intrinsics matrix of shape (3, 3). This is typically the return
value of intrinsics_to_matrix.
intrinsics matrix of shape ( 3 3 ) . This is typically the return value of intrinsics_to_matrix .
camera_dist
np.ndarray
camera distortion parameters shape (5,).
camera distortion parameters shape ( 5 ) .