Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

median

median(
  input: Clip,
  #{
    planes?: Array<Int>,
  }
)

Replaces each processed pixel with the median of the nine samples in its 3x3 neighborhood.

The input must be one fixed-format planar Gray, YUV, or planar RGB clip. Edge pixels use mirrored neighbor coordinates so the filter always sorts a full nine-sample neighborhood at image borders.

If planes is omitted, every plane is processed. If planes is provided, only the listed zero-based plane indexes are processed; all other planes are preserved without modification. An empty array processes no planes.

Examples

output = source("input.mkv").std.median()
output = source("input.mkv").std.median(#{ planes: [0] })

Input

One fixed-format planar Gray, YUV, or planar RGB clip.

Output

A clip with the same format, resolution, timing, and metadata, with selected planes replaced by mirrored-edge 3x3 median samples.

Options

  • planes (Array<Int>, default: all planes) – Zero-based plane indexes to process. Unlisted planes are preserved without modification. An empty array processes no planes.