pandora2d.refinement.dichotomy

Module for Dichotomy refinement method (python version).

Attributes

COST_SELECTION_METHOD_MAPPING

Classes

DichotomyPython

Subpixel refinement method by dichotomy (python version).

CostSurfaces

Container to extract subsampling cost surfaces around a given disparity from cost volumes.

Point

Coordinates of a subpixellic point of cost surface.

Functions

search_new_best_point(→ tuple[Point, numpy.floating, ...)

Find best position and cost after interpolation of cost surface for given precision.

Module Contents

pandora2d.refinement.dichotomy.COST_SELECTION_METHOD_MAPPING[source]
class pandora2d.refinement.dichotomy.DichotomyPython(cfg: dict = None, _: list = None, __: int = 5)[source]

Bases: pandora2d.refinement.refinement.AbstractRefinement

Subpixel refinement method by dichotomy (python version).

NB_MAX_ITER = 9[source]
schema[source]
filter[source]
classmethod check_conf(cfg: dict) dict[source]

Check the refinement method configuration.

Will change number_of_iterations value by Dichotomy.NB_MAX_ITER if above Dichotomy.NB_MAX_ITER.

Parameters:

cfg – user_config for refinement method

Returns:

cfg: global configuration

property margins[source]

Create margins for dichotomy object.

It will be used for ROI and for dichotomy window extraction from cost volumes.

refinement_method(cost_volumes: xarray.Dataset, disp_map: xarray.Dataset, img_left: xarray.Dataset, img_right: xarray.Dataset) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]

Return the subpixel disparity maps

Parameters:
  • cost_volumes – cost_volumes 4D row, col, disp_col, disp_row

  • disp_map – pixel disparity maps

  • img_left – left image dataset

  • img_right – right image dataset

Returns:

the refined disparity maps

class pandora2d.refinement.dichotomy.CostSurfaces(cost_volumes: xarray.Dataset)[source]

Container to extract subsampling cost surfaces around a given disparity from cost volumes.

Cost Surface of point with coordinates row==0 and col==1 can be accessed with cost_surface[0, 1].

The container is iterable row first then columns.

cost_volumes[source]
__getitem__(item)[source]

Get cost surface (cost_volume & criteria) of coordinates item where item is (row, col).

__iter__()[source]

Iter over cost surfaces, row first then columns.

class pandora2d.refinement.dichotomy.Point[source]

Bases: NamedTuple

Coordinates of a subpixellic point of cost surface.

row: int | float | numpy.float32[source]
col: int | float | numpy.float32[source]
pandora2d.refinement.dichotomy.search_new_best_point(cost_surface: xarray.DataArray, precision: float, initial_disparity: tuple[numpy.floating, numpy.floating] | tuple[int, int], initial_position: tuple[numpy.floating, numpy.floating] | tuple[int, int], initial_value: numpy.float32, filter_dicho: pandora2d.interpolation_filter.AbstractFilter, cost_selection_method: collections.abc.Callable) tuple[Point, numpy.floating, numpy.floating, numpy.floating][source]

Find best position and cost after interpolation of cost surface for given precision.

Parameters:
  • cost_surface – Disparities in rows and cols of a point

  • precision – subpixellic disparity precision to use

  • initial_disparity – initial disparities (disp_row, disp_col)

  • initial_position – coordinates (row, col) to interpolate around

  • initial_value – initial value

  • filter_dicho – filter used to do interpolation in dichotomy loop

  • cost_selection_method – function used to select best cost

Returns:

coordinates of best interpolated cost, its value and its corresponding disparities.