pandora2d.disparity.disparity

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

Classes

Disparity

Disparity class

Module Contents

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

Disparity class

_INVALID_DISPARITY = -9999[source]
cfg[source]
_invalid_disparity[source]
property margins[source]

Return disparity map’s Margins.

check_conf(cfg: dict) dict[source]

Check the disparity configuration

Returns:

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

static extrema_split(cost_volumes: xarray.Dataset, axis: int, extrema_func: collections.abc.Callable) 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 – the cost volume dataset

  • axis – research axis

  • extrema_func – minimal or maximal research

Returns:

the disparities for which the cost volume values are the smallest

static get_score(cost_volume: numpy.ndarray, extrema_func: collections.abc.Callable) numpy.ndarray[source]

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

Parameters:
  • cost_volume – the cost volume dataset

  • extrema_func – minimal or maximal research

Returns:

the disparities for which the cost volume values are the smallest

static arg_split(maps: numpy.ndarray, axis: int, extrema_func: collections.abc.Callable) 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:
  • maps – maps with maximum

  • axis – axis

  • extrema_func – minimal or maximal index research

Returns:

the disparities for which the cost volume values are the smallest

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

Disparity computation by applying the Winner Takes All strategy

Parameters:

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

Returns:

three numpy.array:

  • disp_map_col : disparity map for columns

  • disp_map_row : disparity map for row

  • correlation_score_map : map containing matching_cost step score