pandora2d.disparity.disparity

This module contains functions associated to the disparity map computation step.

Module Contents

Classes

Disparity

Disparity class

class pandora2d.disparity.disparity.Disparity(cfg: Dict)[source]

Disparity class

_INVALID_DISPARITY[source]
margins[source]
check_conf(cfg: Dict) Dict[source]

Check the disparity configuration

Returns:

Dict[str, Union[str, int, float]]: disparity configuration

static min_split(cost_volumes: xarray.Dataset, axis: int) numpy.ndarray[source]

Find the indices of the minimum values for a 4D DataArray, along axis. Memory consumption is reduced by splitting the 4D Array.

Parameters:
  • cost_volumes (xarray.Dataset) – the cost volume dataset

  • axis (int) – research axis

Returns:

the disparities for which the cost volume values are the smallest

Return type:

np.ndarray

static max_split(cost_volumes: xarray.Dataset, axis: int) numpy.ndarray[source]

Find the indices of the minimum values for a 4D DataArray, along axis. Memory consumption is reduced by splitting the 4D Array.

Parameters:
  • cost_volumes (xarray.Dataset) – the cost volume dataset

  • axis (int) – research axis

Returns:

the disparities for which the cost volume values are the smallest

Return type:

np.ndarray

static argmax_split(max_maps: numpy.ndarray, axis: int) numpy.ndarray[source]

Find the indices of the maximum values for a 3D DataArray, along axis. Memory consumption is reduced by splitting the 3D Array.

Parameters:
  • max_maps (np.ndarray) – maps with maximum

  • axis (int) – axis

Returns:

the disparities for which the cost volume values are the smallest

Return type:

np.ndarray

static argmin_split(min_maps: numpy.ndarray, axis: int) numpy.ndarray[source]

Find the indices of the minimum values for a 3D DataArray, along axis 2. Memory consumption is reduced by splitting the 3D Array.

Parameters:
  • min_maps (np.ndarray) – maps with minimum

  • axis (int) – axis

Returns:

the disparities for which the cost volume values are the smallest

Return type:

np.ndarray

compute_disp_maps(cost_volumes: xarray.Dataset) Tuple[numpy.ndarray, numpy.ndarray][source]

Disparity computation by applying the Winner Takes All strategy

Parameters:

cost_volumes (xr.Dataset) – the cost volumes datsset with the data variables: - cost_volume 4D xarray.DataArray (row, col, disp_row, disp_col)

Returns:

Two numpy.array:

  • disp_map_col : disparity map for columns

  • disp_map_row : disparity map for row

Return type:

tuple (numpy.ndarray, numpy.ndarray)