OneEuroFilter

class OneEuroFilter(val minCutoff: Double = 1.0, val beta: Double = 0.007, val dCutoff: Double = 1.0)

1€ (One-Euro) Filter for real-time signal smoothing with adaptive cutoff frequency.

Originally published by Géry Casiez, Nicolas Roussel, and Daniel Vogel (CHI 2012): "1 € Filter: A Simple Speed-based Low-pass Filter for Noisy Input in Interactive Systems".

Why this is used in FaceNet / BlazeFace:

MediaPipe BlazeFace short-range detects 6 coarse 2D landmarks (eyes, nose, mouth, ears) on a 128x128 feature grid. When 3D head pose angles (yaw, pitch, roll) are computed from geometric distance ratios between these 2D points, single-pixel landmark variations between video frames cause high-frequency angular jitter (often fluctuating ±3° to ±7° while the head is stationary).

In contrast to static exponential moving averages (which introduce perceptible lag during fast turns when smoothed sufficiently to eliminate static jitter), the One-Euro filter adapts its cutoff frequency dynamically:

  • At low velocity (holding still / looking straight), the cutoff frequency approaches minCutoff, heavily filtering out landmark jitter.

  • At high velocity (turning head during liveness challenges), the cutoff frequency increases proportional to beta * derivative, eliminating latency and tracking head movements in real time.

Constructors

Link copied to clipboard
constructor(minCutoff: Double = 1.0, beta: Double = 0.007, dCutoff: Double = 1.0)

Properties

Link copied to clipboard

Sensitivity coefficient for velocity-dependent cutoff adjustment. Higher values reduce lag during fast movements.

Link copied to clipboard

Cutoff frequency in Hz for the internal derivative (speed) low-pass filter.

Link copied to clipboard

Minimum cutoff frequency in Hertz (Hz). Lower values reduce jitter when stationary.

Functions

Link copied to clipboard
fun filter(value: Double, timestampSeconds: Double): Double

Filters input value value measured at timestampSeconds.

Link copied to clipboard
fun reset()

Resets the filter state (e.g. when a face is lost or a new tracking session begins).