pandora2d.refinement.dichotomy_cpp
Module for Dichotomy refinement method (cpp version).
Classes
Subpixel refinement method by dichotomy (cpp version). |
Functions
|
Transform a disparity map to index map. Indexes correspond to (row/col) disparities in cost volume. |
|
Transform an index map to disparity map. Indexes correspond to (row/col) disparities in cost volume. |
|
Return the map with best matching score |
Module Contents
- class pandora2d.refinement.dichotomy_cpp.Dichotomy(cfg: dict = None, _: list = None, __: int = 5)[source]
Bases:
pandora2d.refinement.refinement.AbstractRefinementSubpixel refinement method by dichotomy (cpp version).
- 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
- pandora2d.refinement.dichotomy_cpp.disparity_to_index(disparity_map: xarray.DataArray, shift: int, subpixel: int) numpy.ndarray[source]
Transform a disparity map to index map. Indexes correspond to (row/col) disparities in cost volume.
- Example:
with subpixel=1 :
- disparity_map = -2 -1 -1 1
- -1
0 -1 -1 0 1 1 1
disparities range = [-4 -3 -2 -1 0 1 2 3]
- index_map = 2 3 3 5
3 4 3 3 4 5 5 5
with subpixel=2 :
- disparity_map = -4 -2 -1.5 -2.5
- -4
- -1
- -1
-1
- -4
-1.5 -1 -1.5
disparities range = [-4 -3.5 -3 -2.5 -2 -1.5 -1]
- index_map = 0 4 5 3
0 6 6 6 0 5 6 5
- Parameters:
disparity_map – 2D map
shift – the first value of the disparity coordinates in the cost volume
subpixel – :sub-sampling of cost_volume
- Returns:
the index map
- pandora2d.refinement.dichotomy_cpp.index_to_disparity(index_map: numpy.ndarray, shift: int, subpixel: int) numpy.ndarray[source]
Transform an index map to disparity map. Indexes correspond to (row/col) disparities in cost volume.
For examples, see disparity_to_index method.
- Parameters:
index_map – 2D map
shift – the first value of the disparity coordinates in the cost volume
subpixel – :sub-sampling of cost_volume
- Returns:
the index map
- pandora2d.refinement.dichotomy_cpp.create_cost_values_map(cost_volumes: xarray.Dataset, disp_map: xarray.Dataset) numpy.ndarray[source]
Return the map with best matching score
- Parameters:
cost_volumes – cost_volumes 4D row, col, disp_col, disp_row
disp_map – pixel disparity maps
- Returns:
the cost_value map and the invalid_disparity_map