# Median filter

The median filter is well known as an edge-preserving smoothing filter. The algorithm selects the median average of all the pixels in the support: the central value in an ordered list of the pixels. Many interpreters only use this filter to smooth faulted horizons, but I think it is much more widely applicable than this. It is highly effective at eliminating spikes and random noise, and preserves edges quite well (see Figures 1g and 2g in Hall 2007^{[1]}). Compared to the mean filter, it is quite aggressive, requiring much smaller supports to get results. Though it is an edge-preserving filter, the main drawback of the filter is a tendency to round off edges, resulting in some over-smoothing.

In principle, the median filter can be used to smooth discrete-variable horizons too, but only if the attribute is ordered. For example, an ordered waveform classification might have classes from 1 to 8, where classes 1 and 2 are more similar to each other than classes 1 and 3, or 1 and 4, and so on. Of course, even if the classes are ordered geophysically, in terms of trace shape, they may not be ordered geologically, in terms of actual rocks. Because of this, Hall does not recommend using the Median filter for waveform classifications or other discrete variables.

## See also

- Smoothing filters
- Trimmed mean filter — of which the median is a special case

## References

- ↑ Hall, M (2007). Smooth operator: smoothing seismic horizons and attributes. The Leading Edge 26 (1), January 2007, p16-20. doi:10.1190/1.2431821