pandora.cost_volume_confidence.ambiguity ======================================== .. py:module:: pandora.cost_volume_confidence.ambiguity .. autoapi-nested-parse:: This module contains functions for estimating confidence from ambiguity. Classes ------- .. autoapisummary:: pandora.cost_volume_confidence.ambiguity.Ambiguity Module Contents --------------- .. py:class:: Ambiguity(**cfg: str) Bases: :py:obj:`pandora.cost_volume_confidence.cost_volume_confidence.AbstractCostVolumeConfidence` Ambiguity class allows to estimate a confidence from the cost volume .. py:attribute:: _ETA_MIN :value: 0.0 .. py:attribute:: _ETA_MAX :value: 0.7 .. py:attribute:: _ETA_STEP :value: 0.01 .. py:attribute:: _PERCENTILE :value: 1.0 .. py:attribute:: _NORMALIZATION :value: True .. py:attribute:: _method :value: 'ambiguity' .. py:attribute:: cfg .. py:attribute:: _eta_min :value: 0.0 .. py:attribute:: _percentile :value: 1.0 .. py:attribute:: _normalization .. py:attribute:: _eta_max .. py:attribute:: _eta_step .. py:attribute:: _indicator :value: 'ambiguity' .. py:attribute:: _etas .. py:attribute:: _nbr_etas .. py:method:: check_conf(**cfg: Union[str, float]) -> Dict[str, Union[str, float]] Add default values to the dictionary if there are missing elements and check if the dictionary is correct :param cfg: ambiguity configuration :type cfg: dict :return cfg: ambiguity configuration updated :rtype: dict .. py:method:: desc() -> None Describes the confidence method :return: None .. py:method:: confidence_prediction(disp: xarray.Dataset, img_left: xarray.Dataset = None, img_right: xarray.Dataset = None, cv: xarray.Dataset = None) -> Tuple[xarray.Dataset, xarray.Dataset] Computes a confidence measure that evaluates the matching cost function at each point :param disp: the disparity map dataset :type disp: xarray.Dataset :param img_left: left Dataset image :tye img_left: xarray.Dataset :param img_right: right Dataset image :type img_right: xarray.Dataset :param cv: cost volume dataset :type cv: xarray.Dataset :return: the disparity map and the cost volume with a new indicator 'ambiguity_confidence' in the DataArray confidence_measure :rtype: Tuple(xarray.Dataset, xarray.Dataset) with the data variables: - confidence_measure 3D xarray.DataArray (row, col, indicator) .. py:method:: normalize_with_percentile(ambiguity: numpy.ndarray) -> numpy.ndarray Normalize ambiguity with percentile . Cost Volume must correspond to min similarity measure :param ambiguity: ambiguity :type ambiguity: 2D np.ndarray (row, col) dtype = float32 :return: the normalized ambiguity :rtype: 2D np.ndarray (row, col) dtype = float32 .. py:method:: compute_ambiguity(cv: numpy.ndarray, etas: numpy.ndarray, nbr_etas: int, grids: numpy.ndarray, disparity_range: numpy.ndarray) -> numpy.ndarray :staticmethod: Computes ambiguity. :param cv: cost volume :type cv: 3D np.ndarray (row, col, disp) :param etas: range between eta_min and eta_max with step eta_step :type etas: np.ndarray :param nbr_etas: number of etas :type nbr_etas: int :param grids: array containing min and max disparity grids :type grids: 2D np.ndarray (min, max) :param disparity_range: array containing disparity range :type disparity_range: np.ndarray :return: the normalized ambiguity :rtype: 2D np.ndarray (row, col) dtype = float32 .. py:method:: compute_ambiguity_and_sampled_ambiguity(cv: numpy.ndarray, etas: numpy.ndarray, nbr_etas: int, grids: numpy.ndarray, disparity_range: numpy.ndarray) :staticmethod: Return the ambiguity and sampled ambiguity, useful for evaluating ambiguity in notebooks :param cv: cost volume :type cv: 3D np.ndarray (row, col, disp) :param etas: range between eta_min and eta_max with step eta_step :type etas: np.ndarray :param nbr_etas: nuber of etas :type nbr_etas: int :param grids: array containing min and max disparity grids :type grids: 2D np.ndarray (min, max) :param disparity_range: array containing disparity range :type disparity_range: np.ndarray :return: the normalized ambiguity and sampled ambiguity :rtype: Tuple(2D np.ndarray (row, col) dtype = float32, 3D np.ndarray (row, col) dtype = float32)