Smoothing filter

Median

Deletes the one frame that went wrong

Replaces each frame with the middle value of its neighbours rather than their average. One absurd reading cannot drag a middle value with it, so the spike disappears instead of being spread around.

Single-frame spike
1.5° of 108° survives
Others, same spike
21–66° survives
Phase lag
0 frames
General noise
Barely improved

Measured on our own test signals at 24fps: a clean sine wave, that wave with ±4° of random noise, and that wave with one frame knocked 108° out of place. These describe how the filter behaves — they are not a validation of markerless measurement against marker-based capture.

How it works

Sort the frames in the window and take the one in the middle. A mean would be pulled towards an outlier in proportion to how absurd it is; a median ignores it entirely, because being the largest value in the window and being the third largest have exactly the same effect on the middle one.

This makes it the only filter here that removes rather than redistributes. It is also why it keeps genuine edges sharp: a real, fast change is a majority of the window, so it survives.

Reach for it when

  • The far-side limb is occluded and its angle leaps for a frame or two — the classic markerless failure, and the one every other filter here handles badly.
  • A chart has isolated vertical spikes rather than a general fuzziness.
  • You want the noise gone without the rest of the signal being touched at all.

What it costs

It is not really a smoother. General jitter is barely improved, because the middle of a noisy window is still noisy. And a spike lasting more than half the window survives — a longer window fixes that, but starts deleting real movement.

What we actually run

So the page and the code say the same thing.

  • Centred window, shortened at the ends of a run rather than padded.
  • The shortest windows of the three window filters — around 0.05s, 0.10s and 0.18s — because the job is outvoting one bad frame, not smoothing. A long median starts removing movement that really happened.
  • The window ladder is forced to grow between strengths, so the setting still does something on a low frame-rate clip where two lengths would otherwise round to the same number of frames.

The research behind it

  1. Tukey, J. W. (1977). Exploratory Data Analysis. Addison-Wesley.

    Introduced running medians as a resistant alternative to running means — resistant meaning one absurd value cannot drag the result with it.

  2. Gallagher, N., & Wise, G. (1981). A theoretical analysis of the properties of median filters. IEEE Transactions on Acoustics, Speech, and Signal Processing, 29(6), 1136–1141.

    Sets out what a median filter preserves and what it removes, including the run-length rule that decides which spikes it can delete.

    doi:10.1109/TASSP.1981.1163708

The other four

Filtering is on Pro and above.