pandora.interval_tools

This module contains functions associated to confidence intervals.

Module Contents

Functions

create_connected_graph(→ numpy.ndarray)

Create a boolean connection matrix from segment coordinates

graph_regularization(→ Tuple[numpy.ndarray, ...)

Regularize the intervals based on quantiles and a given connection graph.

interval_regularization(→ Tuple[numpy.ndarray, ...)

Regularize interval bounds in ambiguous zones.

pandora.interval_tools.create_connected_graph(border_left: numpy.ndarray, border_right: numpy.ndarray, depth: int) numpy.ndarray[source]

Create a boolean connection matrix from segment coordinates

Parameters:
  • border_left ((n, 2) np.ndarray where n is the number of segments) – array containing the coordinates of segments left border

  • border_right ((n, 2) np.ndarray where n is the number of segments) – array containing the coordinates of segments right border

  • depth – the depth for regularization. It corresponds to the number of rows to explore below and above.

Returns:

A symmetric boolean matrix of shape (n, n). 1 indicating that the segment are connected

Return type:

np.ndarray of shape (n, n)

pandora.interval_tools.graph_regularization(interval_inf: numpy.ndarray, interval_sup: numpy.ndarray, border_left: numpy.ndarray, border_right: numpy.ndarray, connection_graph: numpy.ndarray, quantile: float) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]

Regularize the intervals based on quantiles and a given connection graph.

Parameters:
  • interval_inf ((row, col) np.ndarray) – The lower estimation of the disparity to regularize

  • interval_sup ((row, col) np.ndarray) – The upper estimation of the disparity to regularize

  • border_left ((n, 2) np.ndarray where n is the number of segments) – array containing the coordinates of segments left border

  • border_right ((n, 2) np.ndarray where n is the number of segments) – array containing the coordinates of segments right border

  • graph (connection) – A matrix indicating if the segments (n in total) are connected

  • quantile (float. 0 <= quantile <= 1) – Which quantile to select for the regularized value

Returns:

The regularized inf and sup of the disparity, and a boolean mask indicating regularization

Return type:

Tuple[np.ndarray, np.ndarray, np.ndarray]

pandora.interval_tools.interval_regularization(interval_inf: numpy.ndarray, interval_sup: numpy.ndarray, ambiguity: numpy.ndarray, ambiguity_threshold: float, ambiguity_kernel_size: int, vertical_depth: int = 0, quantile_regularization: float = 1.0) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]

Regularize interval bounds in ambiguous zones.

Parameters:
  • interval_inf – lower bound of the confidence interval

  • interval_sup – upper bound of the confidence interval

  • ambiguity – ambiguity confidence map

  • ambiguity_threshold (float) – threshold used for detecting ambiguous zones

  • ambiguity_kernel_size (int) – number of columns for the minimitive kernel applied to ambiguity

  • vertical_depth (int >= 0) – The number of lines above and below to look for adjacent segment during the regularization

  • quantile_regularization (float between 0 and 1) – The quantile used for selecting the disparity value in the regularization step

Returns:

the regularized infimum and supremum of the set containing the true disparity and the mask of pixel that have been regularized

Return type:

Tuple(2D np.array (row, col) dtype = float32, 2D np.array (row, col) dtype = float32, 2D np.array (row, col) dtype = np.bool)