medusa.preproc.filter#

Module Contents#

medusa.preproc.filter.bw_filter(data, fps, low_pass, high_pass)[source]#

Applies a bandpass filter the vertex coordinate time series. Implementation based on this StackOverflow post.

Parameters:
  • data (str, Data) – Either a path (str or pathlib.Path) to a medusa hdf5 data file or a Data object (like FlameData or MediapipeData)

  • low_pass (float) – Low-pass cutoff (in Hz)

  • high_pass (float) – High-pass cutoff (in Hz)

Returns:

data – An object with a class inherited from medusa.core.BaseData

Return type:

medusa.core.*Data

Examples

Filter the data wit a high-pass of 0.005 Hz and a low-pass of 4 Hz:

>>> from medusa.data import get_example_data4d
>>> data = get_example_data4d(load=True, model='mediapipe')
>>> data = bw_filter(data, low_pass=4., high_pass=0.005)
class medusa.preproc.filter.OneEuroFilter(t0, x0, dx0=0.0, min_cutoff=1.0, beta=0.0, d_cutoff=1.0)[source]#

A high-pass filter that can be used in real-time applications; based on the implementation by Jaan Tollander.

Parameters:

TODO

static smoothing_factor(t_e, cutoff)[source]#

Apply smoothing factor.

static exponential_smoothing(a, x, x_prev)[source]#

Apply exponential smoothing.