pandora.filter.median

This module contains functions associated to the median filter used to filter the disparity map.

Module Contents

Classes

MedianFilter

MedianFilter class allows to perform the filtering step

class pandora.filter.median.MedianFilter(*args, cfg: Dict, step: int = 1, **kwargs)[source]

Bases: pandora.filter.filter.AbstractFilter

MedianFilter class allows to perform the filtering step

property margins[source]
_FILTER_SIZE = 3[source]
check_conf(cfg: Dict) 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) – filter configuration

Return cfg:

filter configuration updated

Return type:

dict

desc()[source]

Describes the filtering method

filter_disparity(disp: xarray.Dataset, img_left: xarray.Dataset = None, img_right: xarray.Dataset = None, cv: xarray.Dataset = None) None[source]

Apply a median filter on valid pixels. Invalid pixels are not filtered. If a valid pixel contains an invalid pixel in its filter, the invalid pixel is ignored for the calculation of the median.

Parameters:
  • disp (xarray.Dataset) –

    the disparity map dataset with the variables :

    • disparity_map 2D xarray.DataArray (row, col)

    • confidence_measure 3D xarray.DataArray (row, col, indicator)

    • validity_mask 2D xarray.DataArray (row, col)

  • img_left (xarray.Dataset) – left Dataset image

  • img_right (xarray.Dataset) – right Dataset image

  • cv (xarray.Dataset) – cost volume dataset

Returns:

None

median_filter(data) numpy.ndarray[source]

Apply median filter on valid pixels (pixels that are not nan). Invalid pixels are not filtered. If a valid pixel contains an invalid pixel in its filter, the invalid pixel is ignored for the calculation of the median.

Parameters:

data (2D np.array (row, col)) – input data to be filtered

Returns:

The filtered array

Return type:

2D np.array(row, col)