# spafe.utils.filters¶

spafe.utils.filters.gaussian_filter(M, std, sym=True)[source]

Return a Gaussian window.

spafe.utils.filters.kalman(x, P, measurement, R, motion, Q, F, H)[source]
Parameters: x – initial state P – initial uncertainty convariance matrix measurement – observed position (same shape as H*x) R – measurement noise (same shape as H) motion – external motion added to state vector x Q – motion noise (same shape as P) F – next state function: x_prime = F*x H – measurement function: position = H*x the updated and predicted new values for (x, P)

This version of kalman can be applied to many different situations by appropriately defining F and H.

spafe.utils.filters.kalman_xy(x, P, measurement, R, motion=matrix([[0.], [0.], [0.], [0.]]), Q=matrix([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]))[source]
Parameters: x – initial state 4-tuple of location and velocity: (x0, x1, x0_dot, x1_dot) P – initial uncertainty convariance matrix measurement – observed position R – measurement noise motion – external motion added to state vector x Q – motion noise (same shape as P)
spafe.utils.filters.rasta_filter(x)[source]

% y = rastafilt(x) % % rows of x = critical bands, cols of x = frame % same for y but after filtering % % default filter is single pole at 0.94

spafe.utils.filters.sobel_filter(sig, axis=-1, mode='reflect', cval=0.0)[source]

Calculate a Sobel filter.