Professional Documents
Culture Documents
An Improved Median Filtering Algorithm For Image N
An Improved Median Filtering Algorithm For Image N
com
Abstract
The median filtering algorithm has good noise-reducing effects, but its time complexity is not desirable. The paper
proposed an improved median filtering algorithm. The algorithm uses the correlation of the image to process the
features of the filtering mask over the image. It can adaptively resize the mask according to noise levels of the mask.
The statistical histogram is also introduced in the searching process of the median value. Experimental results show
that the algorithm reduces the noise and retains the details of the image. The complexity of the algorithm is decreased
to O (N), and the performance of noise reduction has effectively improved.
2011 Published by
© 2012 by Elsevier
Elsevier Ltd.
B.V.Selection
Selectionand/or
and/orpeer-review
peer-reviewunder
underresponsibility ofof
responsibility [name
Garryorganizer]
Lee
Open access under CC BY-NC-ND license.
Keywords: Image Processing; Median Filtering; Adaptive Filtering; Statistical Histogram
1. Introduction
Noises may be arisen in the capturing and transmission process of the image. The noise is usually
divided into Gaussian noise, the balanced noise and the impulse noise. The arisen impulse noises display as
light and dark noise pixels under random distribution on the image. This not only corrupts true information
of the image, but also seriously affects the visual effects of the image. Therefore, the reduction of impulse
noises has important significance to image processing and computer vision analysis.
For an image corrupted by noises, we can use linear or nonlinear filter methods to reduce noises. In the
frequency domain, the details are high-frequency components of the image, which easily confused with
high-frequency noises. Therefore, how to keep the image details and effectively filter random noises is the
key to image filtering processing. The median filter is a nonlinear filter and it has widely used in digital
image processing because of its good edge keeping characteristics and reducing impulse noise ability. The
median filter is a rank-order filter. Its noise-reducing effects depend on the size and shape of the filtering
*
This work is substantially supported by natural science fund # KYY09020 from Jiangsu Teachers University of Technology
1875-3892 © 2012 Published by Elsevier B.V. Selection and/or peer-review under responsibility of Garry Lee
Open access under CC BY-NC-ND license. doi:10.1016/j.phpro.2012.03.133
610 Youlian Zhu and Cheng Huang / Physics Procedia 25 (2012) 609 – 616
mask; and its algorithm complexity mainly depends on how to get the median value. In order to improve
the noise-reducing performance of the median filter, scholars proposed many improved methods to the
conventional median filter [1-3]. To improve the searching speed of the median value, people proposed some
fast algorithms based on the dividing-conquering strategy, and simplified the algorithm complexity of the
conventional median filter from O (N2) to O (n ln n) in references [4] and [5]. The prophase work [6] of the
paper further simplified complexity to O (n(1+ln n) /2). Based on the prophase study, this paper proposed
two improvements to the median filtering algorithm:
(1) To improve the noise-reducing performance, the mask may be adaptively resized according to noise
levels of the mask;
(2) According to the median filtering theory, we only require quickly find the median value of the
filtering mask, and not to rank all the pixels of the filtering mask. Therefore, the statistical histogram is
introduced in the searching process of the median value to speed up the searching process.
The median filter is a nonlinear signal processing technology based on statistics. The noisy value of the
digital image or the sequence is replaced by the median value of the neighborhood (mask). The pixels of
the mask are ranked in the order of their gray levels, and the median value of the group is stored to replace
the noisy value. The median filtering output is g ( x, y ) med{ f ( x i, y j ), i, j W } , where f ( x, y ),
g ( x, y ) are the original image and the output image respectively, W is the two-dimensional mask: the mask
size is n u n(where n is commonly odd) such as 3 u 3, 5 u 5, and etc.; the mask shape may be linear, square,
circular, cross, and etc.
2 1 Vi 2 S
V med | ѽҏ (1)
4n f 2 ( n) S 2
n 1
2
where V i2 is input noise power (the variance), n is the size of the median filtering mask, f (n ) is the
function of the noise density. And the noise variance of the average filtering is
1 2
V 02 V i ѽҏ (2)
n
Comparing of (1) and (2), the median filtering effects depend on two things: the size of the mask, and
the distribution of the noise. The median filtering performance of random noise reduction is better than the
average filtering performance, but to the impulse noise, especially narrow pulses are farther apart and the
pulse width is less than n / 2 , the median filter is very effective. The median filtering performance should
be improved if the median filtering algorithm, combined with the average filtering algorithm, can
adaptively resize the mask according to the noise density. Based on this, the paper proposed an improved
median filtering algorithm.
Youlian Zhu and Cheng Huang / Physics Procedia 25 (2012) 609 – 616 611
Improving ideas:
For the natural image, neighboring pixels has strong correlation. The gray value of each pixel is quite
close to neighboring pixels, and the edge pixels have the same property also. If the value of a pixel is
greater or less than the value in the neighborhood, the pixel is contaminated by the noise; otherwise, the
pixel is an available pixel. In the reducing-noise process, we sequentially check each pixel, if the value of a
pixel is greater than the average value in the mask, then we judge that the pixel is contaminated by the
noise and replace it with the median value of the mask; otherwise, we retain the original value of the pixel
unchanged. This method not only reduces the computation time, but also retains the details of the image as
far as possible. The original value of the pixel is replaced with the median value in the mask, and the next
process of computation the average value may make full use of the new value of the pixel. This forms an
iterative process; it not only decreases the time complexity, but also improves the noise-reducing effect
better.
If f (i, j ) is replaced by the factor of improved algorithm f ' (i, j ) , the average and median value are
respectively
average { f (i 1, j ) "
/ ҏ (5)
f (i, j ) f (i, j 1) " f (i 1, j 2)} / 9
med { f (i 1, j ) "
/ ҏ (6)
f (i, j ) f (i, j 1) " f (i 1, j 2)}
According to f / (i, j ) f (i, j ) ˈ average is less than Average. Thus, the spatial extent of the noise
reduction is increase, and the time complexity of the improved algorithm is less than the conventional
algorithm. Steps of the improved algorithm are shown as below.
(1) The mask slides over the image, overlaps the center of the mask with the pixel on the image to
search the center element f (i, j ) ;
(2) To read the values of the corresponding pixels of the mask;
(3) To compute the average value (average) of the mask;
(4) To compare the value of each pixel with average, if the value of each pixel is greater than average,
then searching the median value and let f (i, j ) med ; otherwise, retaining the original value of the pixel
unchanged;
(5) Repeating the step (4), until i j n .
of the mask. Another is to make the complexity of the median algorithm decrease greatly by using the
characteristic of the limited gray-level distribution range.
the standard median filtering the fast median filtering algorithm based on the improved algorithm in the
Size of the algorithm average paper
mask
N ln N N (1+lnN)/2 N
3u3 19 14 9
5u5 80 52 25
7u7 190 119 49
9u9 355 218 81
11 u 11 580 350 121
According to TABLE I, the computation complexity of the improved algorithm is obviously reduced.
4. Simulation Experiments
Experiment 1: comparative experiment among the standard median filtering algorithm, the fast median
filtering algorithm based on average and the improved algorithm in the paper.
10%, 35%, and 45% density impulse noises are respectively added to the original image of Lena. With
VC++6.0, results of the comparative experiment are shown as Fig. 1.
Fig. 2 low signal to noise ratio experiment results of the improved algorithm
Performance estimation:
The effect of the image noise reduction may estimated by the subjective visual effect or the objective
estimation method. The paper takes the peak signal to noise ratio (PSNR) and the signal to noise ratio (SNR)
as the performance estimation standard.
Suppose an original image is f (i, j ) and its size is M u N , the processed image is f OUT (i, j ) and its size
is M u N , where i 1,2,..., M , j 1,2,..., N , then we have
1 MN
MSE
2
¦¦ ( fOUT (i, j ) f (i, j )) ѽҏ (7)
M uN i j
2
a max
PSNR 10 lg( )(dB) ѽҏ (8)
MSE
M N
2
¦¦ f (i, j )
SUM
i j ѽҏ (9)
M N 2
¦¦ ( f OUT ( i , j ) f ( i , j ))
i j
where amax 2k 1 , k denotes the number of a pixel binary bit. If k =8, then amax 255 . The results of two
experiments are shown in the TABLE II.
Experimental results show that the performance of the improved algorithm in the paper is better than
the standard median filtering algorithm and the fast median filtering algorithm based on average.
Especially in low signal to noise ratio condition, the improved algorithm has obvious advantages.
TABLE II Comparison of the Performance of Three Algorithms
5. Conclusions
The paper proposed an improved median filtering algorithm for image noise reduction. It can
adaptively resize the mask according to noise levels of the mask. Combined the median filtering with the
average filtering, the improved algorithm can reduce the noise and retain the image details better. The
statistical histogram is introduced to improve the searching speed of the median value and the correlation
of image has been fully used. Thus, the complexity of the improved algorithm is decreased to O (N).
Experimental results show that the improved algorithm can well do with the relationship between the effect
of the noise reduction and the time complexity of the algorithm. Therefore, it has a good application
prospect in image processing.
References
[1] Guohong Liu, Wenming Guo, "Application of improved arthmetic of median filtering denoising, Computer Engineering
and Applications," 2010, vol.46, no.10, pp.187-189.
[2] Xiaokai Wang, Feng Li, "Improved adaptive median filtering," Computer Engineering and Applications, 2010, vol.46, no.
3, pp. 175-176.
[3] Chao Wang, Zhongfu Ye, "Salt-and-pepper noise removal by adaptive median filter and TV inpainting," Journal of
University of Science and Technology of China, 2008, vol.38, no. 3, pp. 282-287.
[4] Qinghua Huang, Heqin Zhou, Huanqing Feng, "A fast and effective algorithm of pulse noise filtering for imaging data,
"Computer Engineering and Applications, 2002, no. 17, pp. 113- 114, 210.
[5] T S Huang, G T Tang, "A fast two- dimensional median filtering algorithm," IEEE Trans Acoustics, Speech, and Signal
Processing, 1979, vol.27, no. 1, pp. 13- 18.
[6] Chubin Wu, "The fast algorithm of medium filtering based on mean," Journal of Jiangsu Teachers University of
Technology, 2006, vol.12, no.6, pp. 102-106.
[7] Tingbiao Chen, Liangzheng Xia, "Digital image processing," Beijing: Posts & Telecommunications Press, 1994.