A median filter can be used to obtain successful performance in rejecting impulsive (spiky) noise, which has anomalous value compared with neighboring values. Compared with the commonly known smoothing filter, the median filter enjoys several advantages such as preserving edges, being less sensitive to anomalous values and being able to be applied repeatedly. Given a 2D signal, e.g., the waveforms recorded by geophone arrays, a 1D median filter is applied along the spatial direction and each row of the waveform matrix is filtered one by one. Mathematically, a median filter can be expressed using the following formula (Chen, 2015) when applied to a 2D signal:
The solution of minimization problem 1 is the output value for location .
denotes the 1D filtering window. are the position indices in a 2D profile. and are both indices in the filtering window. Both and are temporary variables. is the length of the filtering window. Simply speaking, for each point in the 2D data, the median filter substitutes it with the median of neighbor points included by the window with size . The process of
corresponds to finding the median in the window constructed by