pandora2d.refinement.dichotomy_cpp ================================== .. py:module:: pandora2d.refinement.dichotomy_cpp .. autoapi-nested-parse:: Module for Dichotomy refinement method (cpp version). Classes ------- .. autoapisummary:: pandora2d.refinement.dichotomy_cpp.Dichotomy Functions --------- .. autoapisummary:: pandora2d.refinement.dichotomy_cpp.disparity_to_index pandora2d.refinement.dichotomy_cpp.index_to_disparity pandora2d.refinement.dichotomy_cpp.create_cost_values_map Module Contents --------------- .. py:class:: Dichotomy(cfg: dict = None, _: list = None, __: int = 5) Bases: :py:obj:`pandora2d.refinement.refinement.AbstractRefinement` Subpixel refinement method by dichotomy (cpp version). .. py:attribute:: NB_MAX_ITER :value: 9 .. py:attribute:: schema .. py:attribute:: filter .. py:method:: check_conf(cfg: dict) -> dict :classmethod: Check the refinement method configuration. Will change `number_of_iterations` value by `Dichotomy.NB_MAX_ITER` if above `Dichotomy.NB_MAX_ITER`. :param cfg: user_config for refinement method :return: cfg: global configuration .. py:property:: margins Create margins for dichotomy object. It will be used for ROI and for dichotomy window extraction from cost volumes. .. py:method:: 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] Return the subpixel disparity maps :param cost_volumes: cost_volumes 4D row, col, disp_col, disp_row :param disp_map: pixel disparity maps :param img_left: left image dataset :param img_right: right image dataset :return: the refined disparity maps .. py:function:: disparity_to_index(disparity_map: xarray.DataArray, shift: int, subpixel: int) -> numpy.ndarray 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 :param disparity_map: 2D map :param shift: the first value of the disparity coordinates in the cost volume :param subpixel: :sub-sampling of cost_volume :return: the index map .. py:function:: index_to_disparity(index_map: numpy.ndarray, shift: int, subpixel: int) -> numpy.ndarray Transform an index map to disparity map. Indexes correspond to (row/col) disparities in cost volume. For examples, see disparity_to_index method. :param index_map: 2D map :param shift: the first value of the disparity coordinates in the cost volume :param subpixel: :sub-sampling of cost_volume :return: the index map .. py:function:: create_cost_values_map(cost_volumes: xarray.Dataset, disp_map: xarray.Dataset) -> numpy.ndarray Return the map with best matching score :param cost_volumes: cost_volumes 4D row, col, disp_col, disp_row :param disp_map: pixel disparity maps :return: the cost_value map and the invalid_disparity_map