Skip to content

Rank Filter

The Rank Filter collects pixel intensities in a circular neighbourhood, sorts them by value, and replaces the centre pixel with the value at a chosen rank.

Filter types

TypeRankCommon use
MinimumLowest valueBackground estimation; erosion-like effect on bright objects
MedianMiddle valueImpulse noise removal while preserving edges
MaximumHighest valueDilation-like effect; filling small gaps in bright regions

When to use

  • Median — the most common choice for salt-and-pepper or impulse noise removal before thresholding.
  • Minimum / Maximum — morphological-style operations when you need a non-linear, non-Gaussian effect.

Parameters

ParameterDescription
RadiusRadius of the circular neighbourhood in pixels
Filter typeMinimum, Median, or Maximum

Larger radius values affect a wider neighbourhood and produce a stronger effect. Unlike convolution-based filters, rank filters are non-linear and cannot be described by a kernel matrix.