pandora.matching_cost.zncc

This module contains functions associated to ZNCC method used in the cost volume measure step.

Module Contents

Classes

Zncc

Zero mean normalized cross correlation

Functions

apply_divide_standard(zncc, img_left, img_right, ...)

Divide by the standard deviation of the intensities of the images

class pandora.matching_cost.zncc.Zncc(**cfg: str | int)[source]

Bases: pandora.matching_cost.matching_cost.AbstractMatchingCost

Zero mean normalized cross correlation Zncc class allows to compute the cost volume

check_conf(**cfg: Dict[str, str | int]) Dict[str, str | int][source]

Add default values to the dictionary if there are missing elements and check if the dictionary is correct

Parameters:

cfg (dict) – matching cost configuration

Return cfg:

matching cost configuration updated

Return type:

dict

compute_cost_volume(img_left: xarray.Dataset, img_right: xarray.Dataset, cost_volume: xarray.Dataset) xarray.Dataset[source]

Computes the cost volume for a pair of images

Parameters:
  • img_left (xarray.Dataset) –

    left Dataset image containing :

    • im: 2D (row, col) or 3D (band_im, row, col) xarray.DataArray float32

    • disparity (optional): 3D (disp, row, col) xarray.DataArray float32

    • msk (optional): 2D (row, col) xarray.DataArray int16

    • classif (optional): 3D (band_classif, row, col) xarray.DataArray int16

    • segm (optional): 2D (row, col) xarray.DataArray int16

  • img_right (xarray.Dataset) –

    right Dataset image containing :

    • im: 2D (row, col) or 3D (band_im, row, col) xarray.DataArray float32

    • disparity (optional): 3D (disp, row, col) xarray.DataArray float32

    • msk (optional): 2D (row, col) xarray.DataArray int16

    • classif (optional): 3D (band_classif, row, col) xarray.DataArray int16

    • segm (optional): 2D (row, col) xarray.DataArray int16

  • cost_volume (xr.Dataset) – an empty cost volume

Returns:

the cost volume dataset , with the data variables:

  • cost_volume 3D xarray.DataArray (row, col, disp)

Return type:

xarray.Dataset

pandora.matching_cost.zncc.apply_divide_standard(zncc: numpy.ndarray, img_left: numpy.ndarray, img_right: List[numpy.ndarray], p_std: Tuple[int, int], q_std: Tuple[int, int], i_right: int)[source]

Divide by the standard deviation of the intensities of the images

Parameters:
  • zncc (np.ndarray) –

  • img_left (np.ndarray) – standard deviation raster of left image

  • img_right (List[np.ndarray]) – standard deviation raster list of right image (for each subpix)

  • p_std (Tuple[int, int]) – point interval in the left standard deviation image

  • q_std (Tuple[int, int]) – Point interval in the right standard deviation image

  • i_right (int) – ith image