Medianfilter
Medianfilter is a non-linear digital filtering technique used to reduce impulsive noise in images and signals while preserving edges. For each sample, the value is replaced by the median of the samples in a neighborhood, typically a square window in 2D such as 3x3, 5x5, or larger.
The algorithm is simple: collect values in the window, sort them, take the middle value as output.
Properties: robust to salt-and-pepper noise, preserves edges better than linear filters, but can blur fine texture
Variants and applications: adaptive median filter (AMF) increases the window size where noise is detected; weighted