pandora.matching_cost.cpp.matching_cost_cpp

Functions

compute_matching_costs(img_left, imgs_right, cv, ...)

Given a left image and right images (multiple when doing subpixellic), compute the Census matching costs for all disparities, with the given window.

reverse_cost_volume(left_cv, disp_min)

Create the right_cv from the left_one by reindexing (i,j,d) -> (i, j + d, -d)

reverse_disp_range(left_min, left_max)

Create the right disp ranges from the left disp ranges

cv_masked(cost_volume, mask_left, mask_right_shift, ...)

Apply masking to cost volume based on valid pixels and local disparity ranges

Module Contents

pandora.matching_cost.cpp.matching_cost_cpp.compute_matching_costs(img_left, imgs_right, cv, disps, census_width, census_height)[source]

Given a left image and right images (multiple when doing subpixellic), compute the Census matching costs for all disparities, with the given window.

Parameters:
  • img_left (2D np.array (row, col) dtype = np.float32) – the left image

  • imgs_right (List of 2D np.array (row, col) dtype = np.float32) – the right images

  • cv (3D np.array (row, col, disps) dtype = np.float32) – cost volume to fill

  • disps (np.array (disps) dtype = np.float32) – the disparities to sample, sorted

  • census_width (int) – the width of the census window

  • census_height (int) – the height of the census window

Returns:

the filled cost volume

Return type:

3D np.array (row, col, disps) dtype = np.float32

pandora.matching_cost.cpp.matching_cost_cpp.reverse_cost_volume(left_cv, disp_min)[source]

Create the right_cv from the left_one by reindexing (i,j,d) -> (i, j + d, -d) :param left_cv: the 3D cost_colume data array, with dimensions row, col, disp :type left_cv: np.ndarray(dtype=float32) :param disp_min: the minimum of the right disparities :type min_disp: int64 :return: The right cost volume data :rtype: 3D np.ndarray of type float32

pandora.matching_cost.cpp.matching_cost_cpp.reverse_disp_range(left_min, left_max)[source]

Create the right disp ranges from the left disp ranges :param left_min: the 2D left disp min array, with dimensions row, col :type left_min: np.ndarray(dtype=float32) :param left_max: the 2D left disp max array, with dimensions row, col :type left_max: np.ndarray(dtype=float32) :return: The min and max disp ranges for the right image :rtype: Tuple[np.ndarray(dtype=float32), np.ndarray(dtype=float32)]

pandora.matching_cost.cpp.matching_cost_cpp.cv_masked(cost_volume, mask_left, mask_right_shift, mask_right_native, disp_min, disp_max, disp_range, global_disp_min, subpix)[source]

Apply masking to cost volume based on valid pixels and local disparity ranges

Masks the cost volume by: - Setting entire disparity range to NaN for pixels masked in left image - Setting disparities outside local [disp_min, disp_max] range to NaN - Setting disparities to NaN if corresponding right pixel is masked

Parameters:
  • cost_volume (np.ndarray(dtype=float32)) – the 3D cost volume data array (row, col, disp)

  • mask_left (np.ndarray(dtype=float32)) – the 2D left mask array (row, col)

  • mask_right_native (np.ndarray(dtype=float32)) – the 2D right mask for whole pixel disparities (row, col)

  • mask_right_shift (np.ndarray(dtype=float32)) – the 2D right mask for subpix disparities (row, col)

  • disp_min (np.ndarray(dtype=float32)) – the 2D local minimum disparities (row, col)

  • disp_max (np.ndarray(dtype=float32)) – the 2D local maximum disparities (row, col)

  • disp_range (np.ndarray(dtype=float32)) – the 1D disparity range values (disp)

  • global_disp_min (int) – global cost volume minimum disparity

  • subpix (int) – subpixel precision

Returns:

None

Return type:

None