# A Spatial Median Filter for Noise Removal in Digital Images

With each snap of a digital photograph, a signal is transmitted from photon sensor to a memory chip embedded inside a camera. Transmission technology is prone to a degree of error, and noise is added to each photograph. Signi? cant work has been done in both hardware and software to improve the signal-to-noise ratio in digital photography. In software, a smoothing ? lter is used to remove noise from an image. Each pixel is represented by three scalar values representing the red, green, and blue chromatic intensities. At each pixel studied, a smoothing ? lter takes into account the surrounding pixels to derive a more accurate version of this pixel.

By taking neighboring pixels into consideration, extreme “noisy” pixels can be replaced. However, outlier pixels may represent uncorrupted ? ne details, which may be lost due to the smoothing process. This paper examines four common smoothing algorithms and introduces a new smoothing algorithm. These algorithms can be applied to one-dimensional as well as two-dimensional signals. Figure 1. Examples of common ? ltering approaches. (a) Original Image (b) Mean Filtering (c) Median Filtering (d) Root Signal of Median Filtering (e) Component wise Median Filtering (f) Vector Median Filtering.

The simplest of these algorithms is the Mean Filter as de? ned in (1). The Mean Filter is a linear ? lter which uses a mask over each pixel in the signal. Each of the components of the pixels which fall under the mask are averaged together to form a single pixel. This new pixel is then used to replace the pixel in the signal studied. The Mean Filter is poor at maintaining edges within the image. 1 N ? xi N i=1 MEANFILT ER(x1 , … , xN ) = (1) The use of the median in signal processing was ? rst introduced by J. W. Tukey [1].

When ? ltering using the Simple Median Filter, an original pixel and the resulting ? ltered pixel of the sample studied are sometimes the same pixel. A pixel that does not change due to ? ltering is known as the root of the mask. It can be shown that after suf? cient iterations of median ? ltering, every signal converges to a root signal [2]. The Component Median Filter, de? ned in (3), also relies on the statistical median concept. In the Simple Median Filter, each point in the signal is converted to a single magnitude. In the Component Median Filter each scalar component is treated independently.

A ? lter mask is placed over a point in the signal. For each component of each point under the mask, a single median component is determined. These components are then combined to form a new point, which is then used to represent the point in the signal studied. When working with color images, however, this ? lter regularly outperforms the Simple Median Filter. When noise affects a point in a grayscale image, the result is called “salt and pepper” noise. In color images, this property of “salt and pepper” noise is typical of noise models where only one scalar value of a point is affected.