pandora.cpp.img_tools_cpp

Functions

find_valid_neighbors(dirs, disp, valid, row, col, ...)

Find valid neighbors along directions

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

Interpolation of the input image to resolve invalid (nodata) pixels.

Module Contents

pandora.cpp.img_tools_cpp.find_valid_neighbors(dirs, disp, valid, row, col, msk_pixel_invalid)[source]

Find valid neighbors along directions

Parameters:
  • dirs (2D np.ndarray (row, col)) – directions in which the valid neighbors will be searched, around the (row, col) pixel. Ex: [[0,1],[1,0],[0,-1],[-1,0]] to search in the axis-aligned cross centered on the pixel.

  • disp (2D np.ndarray (row, col)) – disparity map

  • valid (2D np.ndarray (row, col)) – validity mask

  • row (int) – row current value

  • col (int) – col current value

  • msk_pixel_invalid (int) – value for the PANDORA_MSK_PIXEL_INVALID constant in pandora.constants

Returns:

valid neighbors

Return type:

2D np.ndarray

pandora.cpp.img_tools_cpp.interpolate_nodata_sgm(img: numpy.ndarray, valid: numpy.ndarray, msk_pixel_invalid: int, msk_pixel_filled_nodata: int) Tuple[numpy.ndarray, numpy.ndarray][source]

Interpolation of the input image to resolve invalid (nodata) pixels. Interpolate invalid pixels by finding the nearest correct pixels in 8 different directions and use the median of their disparities.

HIRSCHMULLER, Heiko. Stereo processing by semiglobal matching and mutual information. IEEE Transactions on pattern analysis and machine intelligence, 2007, vol. 30, no 2, p. 328-341.

Parameters:
  • img (2D np.ndarray (row, col)) – input image

  • valid (2D np.ndarray (row, col)) – validity mask

  • msk_pixel_invalid (int) – value for the PANDORA_MSK_PIXEL_INVALID constant in pandora.constants

  • msk_pixel_filled_nodata (int) – value for the PANDORA_MSK_PIXEL_FILLED_NODATA constant in pandora.constants

Returns:

the interpolate input image, with the validity mask update :

  • If out & PANDORA_MSK_PIXEL_FILLED_NODATA != 0 : Invalid pixel : filled nodata pixel

Return type:

tuple(2D np.array (row, col), 2D np.array (row, col))