3rd IFAC International Conference on Intelligent Control and Automation Science. September 2-4, 2013. Chengdu, China
A Local Pixel Distribution Based Self-adaptive Median Filter for Removal of Pepper and Salt Noise Yuan Xin-xing*,***. Wen Peng** Fan Xiu-xiang*. Fu Bo***,*. Zhang Min* *School of Electrical and Electronics Engineering, Hubei University of Technology, Wuhan, China 430068 (e-mail:
[email protected]). **Faculty of Engineering and Surveying, University of Southern Queensland, Toowoomba, QLD 4350 Australia (e-mail:
[email protected]) *** Dongguan -HUST Manufacturing Engineering Institute, Dongguan 523000, China, (e-mail:
[email protected])} Abstract: As we know, for any image, the intensive function varies distinctly in the whole domain and fluctuates little in a small area or a special direction. We name this local pixel value distribution information as priori knowledge. After detecting the salt and pepper noise pixels, the self-adaptive median filter is use to find a suitable window containing more non-noise pixels. By applying the priori knowledge to these non-noise pixels, we deduce maximum likelihood value of the target pixel. Simulations with the restoring attention and peak signal-noise ratio are carried out to demonstrate that the proposed algorithm have superior performance to the existing classical methods. Keywords: Signal Processing, Pepper and Salt noise, Priori-knowledge, Median Filter, Self-adaptive median filter. introduced to increase the number of non-noise pixels by adjusting the window size according to noise density. Hwang H., Haddad A. (1995), Chang C., et. al. (2008), Abdullah T., Lnan G. (2007), Allaperumal K., Varghese J. (2006). However, the replaced median values may be less correlated to the original pixels and it is likely that the median values may also be seriously distorted when increasing window size. Therefore, K. Aiswarya et al. have proposed DBUTM algorithm in which the corrupted processing pixel is replaced by a median value of the pixels in the 3×3 window after trimming impulse values. Deivalakshmi S., et. al. (2011). This algorithm has a good effect of noise-suppression but it tends to fail whenever the pixels are all corrupted in the window. Thus, Ahmet M. E., Paul S. F. (1995) presented an improved median filter (IMF) to remove noisy pixels by a dynamic size filter. This idea motivates us to analyze the relationship of pixel values in a window template. We find that although we can recognize the shapes in an image distinctly, pixel values vary little in a small area. If we can make full use of local distribution information to deduce the maximum likelihood value of the target pixel, the PSNR of the recovery image may be increased.
1. INTRODUCTION In practical applications, the removal of image noise and preserving image details, maintaining their original characteristics as much as possible, and improving the signal-to-noise ratio have been hot issues in the field of image processing. As the best-known and most widely used nonlinear digital filter, the standard median filter (SMF) is popular for its capability to remove impulse noise as well as preserve the edges. Tukey J.W.(1971). However, roaming the filter window template on the image pixel by pixel is a complex sorting and time-consuming processing. Because noise and non-noise pixels are both modified, the removal of impulse noise often leads to blurring images, distorts the shape features and reduces Peak Signal Noise Ratio (PSNR). Sun S., Wang S. (2009). Many improved algorithms have improved algorithms have been proposed to overcome the above deficiencies in recent years. In order to distinguish signal pixels and noise pixels, Suo J. (2010) provided a new noise-detection algorithm based on Improved Standard Median filter (ISM) according to distribution of local pixels. Then the filtering is applied only to corrupted pixels while leaving uncorrupted pixels intact. However, ISM’s performance is not very well as SMF does at higher noise densities.
2. MEDIAN FILTER 2.1 Standard Median Filter
In SMF and some associated algorithms, the centre corrupted pixel is replaced by the median of the window. When facing higher noise densities, the median value may also be a noisy pixel, in which case the noise removal performance is seriously reduced. So the adaptive median filter (AMF) is
978-3-902823-45-8/2013 © IFAC
Median filter is popular for its capability to remove impulse noise as well as preserve the edges. Let us define a m× m window touring every pixel in an image. The elements of the window are sorted as a 1-dimensional array {a1, a2, a3,…, an} in ascending order by their values, where n= m× m. Then the 63
10.3182/20130902-3-CN-3020.00179
IFAC ICONS 2013 September 2-4, 2013. Chengdu, China
central value M of the window is replaced by median value of the array. M Median{a1 , a 2 ...a n } a n 1 2 ,
n is odd
When we analyze the local pixel value distribution, it can be found that a pixel value is often equal or similar to its adjacent pixel values in original digital images. As shown in Fig.1, (a) shows the coordinate definition for a window, and (4) gives a local pixel value distribution for a small image piece from Lena image. When focusing on an image piece, we find that the variation tendency of adjacent pixel values along a row, a column or a diagonal in local region usually presents some regularity which we call it as “prioriknowledge”. Furthermore, combined with the moving direction of the window, we define the following rules.
(1)
a n 2 a n 1 2 , n is even (2) 2 The algorithm of SMF can be carried out in the following procedures. M Median {a1 , a 2 ...a n }
Step 1: A m× m window template (usually 3×3 or 5×5) is centered at the target pixel. It roars the whole image pixels one by one from left to right and top to bottom.
Rule 1: As shown in Fig. 2, due to the filtering moving from left to right and top to bottom, so window filtering processing, pixels on the left and labelled by blue rectangle have been processed informative.
Step 2: The pixel values in the template are sorted in ascending order and stored in a one-dimensional array to select the median value. Step 3: The central pixel of the template is replaced by the median value above. As we know, SMF has a good performance for removal of impulse noise, especially at low noise-density. However, its ability of removing noise is restrained at higher densities. In addition, SMF operates uniformly across the image and modify both noise and non-noise pixels. Consequently, it not only leads to images with blurred and distorted features but also costs a lot of time.
f(x-1, y-1)
f (x-1, y)
f (x-1, y+1)
f (x, y-1)
f (x, y)
f (x, y+1))
f (x+1, y-1)
f (x, y+1)
f (x+1, y+1)
window in each top area and are
(a) A filtering window of size 3×3
2.2 Improved Self-adaptive Median Filter Improved self-adaptive median filter (IMF) based on dynamic window size was proposed based on classical self-adaptive median filtering algorithm by S. Deivalakshmi et.al. It is executed as follows
162
162 162 161
162
162 163 161
162
163 163 161
(b) Local pixel distribution for a small region Fig.1 Filtering window for local distribution
(1) To detect noise pixels f (x,y) by comparing the simple threshold and mean around the target pixel.
Processed and informative pixel values
Filtering window 154 154 154 155 156 156 156
(2) To select a 3×3 window centring at the noise pixel f(x,y). If there exists informative pixels around f(x,y), f(x,y) is replaced by the median value of these informative pixels in the window.
155 0 156 155 255 157 157 Target pixel
(3) If there are not enough informative pixels around f(x,y), the window would be extended to 5×5 (or 7×7) and the above steps are repeated.
156 157 255 156 157 157 158 158 158 156 255 159 158
0
158 0 157 0 160 255 159
Because noisy pixels are replaced by the median values got from informative pixels, IMF algorithm avoids the spread of noisy signals in the adjacent area efficiently during filtering. However, the process of restoring does not consider the original pixel distribution. There are often significant correlations between adjacent pixel values in a nature image, so noisy pixels replaced by adjacent values other than median values would be more accurate sometimes.
Fig.2 Filtering processingMedian filter is popular for its capability to remove impulse noise as well as preserve the edges. Let us define a m× m window touring every pixel in an image. The elements of the window are sorted as a 1dimensional array {a1, a2, a3,…, an} in ascending order by their values, where n= m× m. Then the central value M of the window is replaced by median value of the array.
3. THE PROPOSED METHOD
Rule 2: To replace the target pixel value by its adjacent pixels based on the following items.
3.1 Local Pixel Distribution Information
If f ( x 1, y 1) f ( x, y 1), f ( x, y ) f ( x 1, y )
64
(3)
IFAC ICONS 2013 September 2-4, 2013. Chengdu, China
Elseif f ( x 1, y 1) f ( x 1, y ), f ( x, y ) f ( x, y 1) (4)
K 1
i 0
i
(9) K Based on the theory of statistics, we know that can be considered as the noise density. If the extreme value distribution coefficients i , i are more bigger than . The extreme value pixels of ith part are original.
Elseif f ( x 1, y ) f ( x, y 1), f ( x, y ) f ( x 1, y 1) (5)
And, if all above conditions are not met, SMF algorithm is used to deduce the target pixel values. Noise image input
Noise detection
Boundary treatment
Pixel scanning
(a) Original Lena image Is the pixel noise?
(b) ND=30% noise image
N
Y Filtering by local pixel distribution rules
No action for this pixel
To restore the target image
(c) To Restore from SMF
(d) To Restore from ISM
Fig.3 Brief flow of the propose method 3.2 Noise Detection by Extreme Value Distribution Sou J. (2010) introduced noise detection operation into median filtering to save the computational time. However, when we want to distinguish noise points from the original pixels, it is difficult to determine whether an extreme value (near 0 or 255 for a grey image) pixel is original or not. In fact, for a pepper and salt noise polluted image, if extreme pixels are original, they always array neatly. Otherwise, these points flash disorderly.
(e) To Restore from IMF (f) To Restore from our method Fig.4 Comparison results for ND=30% noise added Lena image
Then let us divide a n× n image domain into K parts and give two little thresholds ε1>0, ε2>0. Each part has si number of pixels. We define σi as the number of minimum values which satisfy f(x,y)< ε1 and γi as the number of maximum values which satisfy |255-f(x,y)|< ε2 . Thus the minimum value and maximum value distribution densities are defined respectively.
i i si i i si i i i si
3.3 Filtering Implementation Because the filtering window cruises the image domain from left to right line by line, we use the top-left pixels in the window to determine the central pixel. After detecting the noise pixels, the proposed method focuses on filtering noisy pixels at the boundaries of the image. Next, the rules derived from section 3.1 are used to revise the noisy pixels. We define the following processing.
(6) (7)
Step 1: To detect the noise pixels by using the method of extreme pixel distribution. The position of noisy pixel will be stored in a temporary array.
(8)
Then the average extreme value distribution is expressed as follow. 65
IFAC ICONS 2013 September 2-4, 2013. Chengdu, China
Step 2: To modify the noisy pixel values at the boundaries by interpolation between two nearest informative pixels.
and fine details much better than IMF. In order to distinguish the filtering efficiencies of these methods, the Peak Signal Noise Ratio (PSNR) and Mean Square Error (MSE) are adopted as evaluation criteria. Ahmet M. E., Paul S. F. (1995). The two parameters are defined as follows.
Step 3: A moving 3×3 window is placed at the noisy pixel f(x,y). Then priori-knowledge based rules are applied to the revision of the noisy pixel.
PSNR 10lg 1 MN
Step 4: If there are no enough informative pixels in the window, the filtering window dimensional is extended to 5×5 or larger lattice to find more informative pixels to determine the value of f(x,y).
255 2 ( S P ) i, j i, j i, j 2
mn
(S
i, j
MSE
(a) Original Lena image
(10)
Pi , j )2
i, j
(11)
MN
Where M and N are the length and width of the image, Si,j, Pi,j denote the pixel values of the original and the restored image respectively. The quantitative performances in terms of PSNR, MSE for all the compared algorithms at different noise densities are given in Tab.1 and the results are plotted in Fig. 6 and Fig.7.
(b) ND=85% noise image
Tab.1 Comparison results of various filters for Lena image at different noise densities
(c) To Restore from SMF
N D % 10 20 30 40 50 60 70 75 80 85 90
(d) To Restore from ISM
SMF
ISM
IMF
ourd method
PSNR (db)
MSE
PSN R(db)
MSE
PSN R(db)
MSE
PSNR (db)
MSE
29.1 28.1 27.1 26. 24.1 21.8 18.9 17. 15.1 13.2 11.5
8.98 10.0 11.3 12.7 15.8 20.8 28.8 36.1 44.6 55.6 67.7
30.2 29.2 28.2 27.2 25.1 22.8 19.9 18. 16.2 14.5 13.
7.86 8.80 9.89 11.2 14.1 18.5 25.9 32.3 39.5 48.1 57.2
31.6 30.2 29.2 28.4 27.5 26.6 25.5 24.8 24.2 23.4 22.7
6.89 7.84 8.87 9.70 10.8 12. 13.5 14.7 15.7 17.2 18.6
32. 31.3 30.5 29.8 28.9 28.1 27.2 26.6 26. 25.6 25.1
6.41 6.96 7.58 8.28 9.14 10.0 11.1 11.9 12.8 13.4 14.1
It is seen from Tab.1 that the performance of the proposed method is better than other algorithms at different noise densities from 10% to 90%. Based on SMF, ISM introduced noise detection to discriminate uncorrupted pixels from the corrupted pixels. Only the corrupted pixels are filtered. Thus, it provides higher PSNR and lower MSE than SMF. Furthermore, IMF which can change the size of the window in terms of different noise densities to collect enough informative pixels provides much better performance. In the end, due considering the characteristics of local pixel distribution in the original image, the proposed method derived from IMF extracts priori-knowledge rules from local pixel values distribution and makes full use of characteristics of filtering and the correlation of adjacent pixels. Therefore, experimental results show that the proposed method gives the best filtering performance in the four tested methods. Fig.6 and Fig.7 intuitively show that the proposed method has a better performance and smaller error.
(e) To Restore from IMF (f) To Restore from our Method Fig.5 Comparison results for ND=85% noise added Lena image 4. EXPERIMENTAL RESULTS In order to demonstrate the advantage of the proposed method, we compare its performance of revising the pepper and salt noise polluted image with several classical median filters which are SMF, ISM and IMF. The comparison results got from 512×512, 8-bits/pixel grey-level Lena images with different noise densities (ND) of pepper and salt noise are shown in Fig. 4 and Fig.5. Fig.4 and Fig.5 show that IMF and the proposed method have better performance in filtering the pepper and salt noise than other filters. And the proposed method preserves the edges 66
PSNR(db)
IFAC ICONS 2013 September 2-4, 2013. Chengdu, China
36
Science and Research, and Health Care Institutions (2011108102051), and the State Key Lab of Digital Manufacturing Equipment and Technology Open Project (No. DMEFKF2008010).
32 28 24
REFERENCES
20 16
Tukey J.W. (1971). Exploratory Data Analysis. AddisonWesley, Reading, MA, 1971. Sun S., Wang S. (2009). Algorithm of Improved Extremum and Median Value Filter. Computer Science, 36(6), 165167. Suo J. (2010). A New Improved Filtering Algorithm Based on Median Filter Algorithm. Beijing University of Posts and Telecommunications. Hwang H., Haddad A. (1995). Adaptive median filters: New algorithms and results. IEEE Trans. on Image Processing, 4, 499-502. Chang C., Hsiao J., Hsieh C. (2008). An Adaptive Median Filter for Image Denoising. Proceedings-2008 2nd International Symposium on Intelligent Information Technology Application, v.2, 346 – 350 Abdullah T., Lnan G. (2007). Impulse noise reduction in medical images with the use of switch mode fuzzy adaptive median filter. Digital Signal Processing, 17(4), 711-723. Allaperumal K., Varghese J. (2006). Selective Switching Median Filter for the Removal of Salt & Pepper Impulse Noise, IFIP International Conference on Wireless and Optical Communications Networks. Aiswarya K., Jayaraj V., Ebenezer D. (2010). A New and Efficient Algorithm for the Removal of High Density Salt and Pepper Noise in Images and Videos. 2nd International Conference on Computer Modeling and Simulation, v.4, 409-413. Deivalakshmi S., Sarath S., Palanisamy P. (2011). Detection and Removal of Salt and Pepper noise in images by Improved Median Filter. IEEE Recent Advances in Intelligent Computational Systems, 363-368. Ahmet M. E., Paul S. F. (1995). Image quality measures and their performance. IEEE Trans. on Communications, 43 (12), 2959-2965.
TMF
12
ISM
8
IMF
4
Proposed Method
0 10%
20%
30%
40%
50%
60%
70%
75%
80%
85%
90%
Noise Density
Fig.6 Comparison graph of PSNR at different Noise densities for Lena image 70
MSE
65 60 55 50
TMF ISM IMF Proposed Method
45 40 35 30 25 20 15 10 5 0 10%
20%
30%
40%
50%
60%
70%
75%
80%
85%
90%
Noise Density
Fig.7 Comparison graph of MSE at different Noise densities for Lena image 5. CONCLUSIONS A self-adaptive median filter based on local pixel distribution information to remove pepper and salt noise is presented in this paper. Firstly, an efficient noise detector is applied to classify all pixels into two categories of noises and original points. According to the moving direction of filtering window, all pixels on the top-left of the target pixel are considered processed and informative. Then, noisy pixels are restored by a filtering window with multi-rules concluded from local pixel distribution. Furthermore, for the case of high noise density, the self-adaptive filtering window is used to collect more informative pixels. Experimental results show that the performance of the proposed method is much superior to that of classical median filters. ACKNOWLEDGEMENTS The project is supported by Industrial Technique Foundation of Guangdong Province (2011B010100037) and Science and Technological Program for Dongguan′s Higher Education, 67