pandora.refinement.refinement
This module contains classes and functions associated to the subpixel refinement step.
Module Contents
Classes
Abstract Refinement class |
- class pandora.refinement.refinement.AbstractRefinement[source]
Abstract Refinement class
- subpixel_refinement(cv: xarray.Dataset, disp: xarray.Dataset) None [source]
Subpixel refinement of disparities and costs.
- Parameters:
cv (xarray.Dataset) –
the cost volume dataset with the data variables:
cost_volume 3D xarray.DataArray (row, col, disp)
confidence_measure 3D xarray.DataArray (row, col, indicator)
disp (xarray.Dataset) –
Dataset with the variables :
disparity_map 2D xarray.DataArray (row, col)
confidence_measure 3D xarray.DataArray (row, col, indicator)
validity_mask 2D xarray.DataArray (row, col)
- Returns:
None
- approximate_subpixel_refinement(cv_left: xarray.Dataset, disp_right: xarray.Dataset) xarray.Dataset [source]
Subpixel refinement of the right disparities map, which was created with the approximate method : a diagonal search for the minimum on the left cost volume
- Parameters:
cv_left (xarray.Dataset) –
the left cost volume dataset with the data variables:
cost_volume 3D xarray.DataArray (row, col, disp)
confidence_measure 3D xarray.DataArray (row, col, indicator)
disp_right (xarray.Dataset) –
right disparity map with the variables :
disparity_map 2D xarray.DataArray (row, col)
confidence_measure 3D xarray.DataArray (row, col, indicator)
validity_mask 2D xarray.DataArray (row, col)
- Returns:
disp_right Dataset with the variables :
disparity_map 2D xarray.DataArray (row, col) that contains the refined disparities
confidence_measure 3D xarray.DataArray (row, col, indicator) (unchanged)
validity_mask 2D xarray.DataArray (row, col) with the value of bit 3 ( Information: calculations stopped at the pixel step, sub-pixel interpolation did not succeed )
interpolated_coeff 2D xarray.DataArray (row, col) that contains the refined cost
- Return type:
xarray.Dataset
- classmethod register_subclass(short_name: str)[source]
Allows to register the subclass with its short name
- Parameters:
short_name (string) – the subclass to be registered
- static loop_refinement(cv: numpy.ndarray, disp: numpy.ndarray, mask: numpy.ndarray, d_min: int, d_max: int, subpixel: int, measure: str, method: Callable[[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, str], Tuple[int, int, int]]) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray] [source]
Apply for each pixels the refinement method
- Parameters:
cv (3D numpy array (row, col, disp)) – cost volume to refine
disp (2D numpy array (row, col)) – disparity map
mask (2D numpy array (row, col)) – validity mask
d_min (int) – minimal disparity
d_max (int) – maximal disparity
subpixel (int ( 1 | 2 | 4 )) – subpixel precision used to create the cost volume
measure – the measure used to create the cot volume
measure – string
method – the refinement method
method – function
- Returns:
the refine coefficient, the refine disparity map, and the validity mask
- Return type:
tuple(2D numpy array (row, col), 2D numpy array (row, col), 2D numpy array (row, col))
- abstract static refinement_method(cost: numpy.ndarray, disp: float, measure: str) Tuple[float, float, int] [source]
Return the subpixel disparity and cost
- Parameters:
cost (1D numpy array : [cost[disp -1], cost[disp], cost[disp + 1]]) – cost of the values disp - 1, disp, disp + 1
disp (float) – the disparity
measure (string = min | max) – the type of measure used to create the cost volume
- Returns:
the refined disparity (disp + (sub_disp/subpix)), the refined cost and the state of the pixel ( Information: calculations stopped at the pixel step, sub-pixel interpolation did not succeed )
- Return type:
float, float, int
- static loop_approximate_refinement(cv: numpy.ndarray, disp: numpy.ndarray, mask: numpy.ndarray, d_min: int, d_max: int, subpixel: int, measure: str, method: Callable[[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, str], Tuple[int, int, int]]) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray] [source]
- Apply for each pixels the refinement method on the right disparity map which was created with the approximate
method : a diagonal search for the minimum on the left cost volume
- Parameters:
cv (3D numpy array (row, col, disp)) – the left cost volume
disp (2D numpy array (row, col)) – right disparity map
mask (2D numpy array (row, col)) – right validity mask
d_min (int) – minimal disparity
d_max (int) – maximal disparity
subpixel (int ( 1 | 2 | 4 )) – subpixel precision used to create the cost volume
measure (string = min | max) – the type of measure used to create the cost volume
method (function) – the refinement method
- Returns:
the refine coefficient, the refine disparity map, and the validity mask
- Return type:
tuple(2D numpy array (row, col), 2D numpy array (row, col), 2D numpy array (row, col))