oakutils.filters package

Submodules

oakutils.filters.smoothing module

Module for filters which smooth numpy arrays.

Classes

ExpSmooth

A class for exponentially smoothing numpy arrays.

class oakutils.filters.smoothing.ExpSmooth(alpha: float = 0.9)

Bases: object

A class for exponentially smoothing numpy arrays.

alpha

The alpha parameter for the exponential smoothing.

Type:

float

smooth()

Use to smooth a numpy array.

property alpha: float

The alpha parameter for the exponential smoothing.

Returns:

The alpha parameter for the exponential smoothing.

Return type:

float

smooth(data: list[np.ndarray]) np.ndarray

Use to smooth a numpy array.

Parameters:

data (list[np.ndarray]) – The data to smooth.

Returns:

The smoothed data.

Return type:

np.ndarray

oakutils.filters.wls module

Module for using the WLS filter on disparity images.

Classes

WLSFilter

A class for computing the weighted-least-squares filter, on disparity images.

class oakutils.filters.wls.WLSFilter(cam_data: StereoCalibrationData, lamb: int = 8000, sigma: float = 1.0, disp_levels: int = 96)

Bases: object

A class for computing the weighted-least-squares filter on disparity images.

filter_frame(disparity: np.ndarray, mono_frame: np.ndarray, *, use_mono_left: bool | None = None) tuple[np.ndarray, np.ndarray]

Use to filter the disparity image.

Parameters:
  • disparity (np.ndarray) – The disparity image to filter.

  • mono_frame (np.ndarray) – The mono frame to use for the filter.

  • use_mono_left (bool) – Whether to use the left mono frame. Defaults to True.

Returns:

  • np.ndarray – The filtered disparity image.

  • np.ndarray – The new depth image.

property lamb: int

The lambda parameter for the WLS filter.

Returns:

The lambda parameter.

Return type:

int

property sigma: float

The sigma parameter for the WLS filter.

Returns:

The sigma parameter.

Return type:

float

Module contents

Module for performing filtering on typical datatypes.

Submodules

wls

Module for performing WLS filtering.

Classes

WLSFilter

A class for computing the weighted-least-squares filter, on disparity images.

class oakutils.filters.WLSFilter(cam_data: StereoCalibrationData, lamb: int = 8000, sigma: float = 1.0, disp_levels: int = 96)

Bases: object

A class for computing the weighted-least-squares filter on disparity images.

filter_frame(disparity: np.ndarray, mono_frame: np.ndarray, *, use_mono_left: bool | None = None) tuple[np.ndarray, np.ndarray]

Use to filter the disparity image.

Parameters:
  • disparity (np.ndarray) – The disparity image to filter.

  • mono_frame (np.ndarray) – The mono frame to use for the filter.

  • use_mono_left (bool) – Whether to use the left mono frame. Defaults to True.

Returns:

  • np.ndarray – The filtered disparity image.

  • np.ndarray – The new depth image.

property lamb: int

The lambda parameter for the WLS filter.

Returns:

The lambda parameter.

Return type:

int

property sigma: float

The sigma parameter for the WLS filter.

Returns:

The sigma parameter.

Return type:

float