Median filter

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:

$\displaystyle \min_{u_m\in U_{i,j}}\sum_{l=1}^{L}\Arrowvert u_m-u_l \Arrowvert_1,$ (1)

The solution of minimization problem 1 is the output value for location $x_{i,j}$. $U_{i,j}=\{u_1,u_2,\cdots,u_L\}$ denotes the 1D filtering window. $i,j$ are the position indices in a 2D profile. $l$ and $m$ are both indices in the filtering window. Both $u_l$ and $u_m$ are temporary variables. $L$ 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 $L$. The process of $\min_{u_m}\sum_{l=1}^{L}\Arrowvert u_m-u_l \Arrowvert_1$ corresponds to finding the median in the window constructed by $\{u_1,u_2,u_3,\cdots,u_L\}$.