You are on page 1of 7

Salt and Pepper Noise Removal Using Pixel Connectivity Theory and Detail-Preserving Regularization

Aravinth Chinnapalanichamy. Department of ECE College of Engineering Guindy Anna University Chennai-600025, India aravinthcp@gmail.com Ajith Kunnathmadam Department of ECE College of Engineering Guindy Anna University Chennai-600025, India ajithneel03@yahoo.co.in Arjun Dev Singh Ramesh Department of ECE College of Engineering Guindy Anna University Chennai-600025, India adarjuna@gmail.com

ABSTRACT
In this paper, a morphological approach based on pixel connectivity is proposed for removing impulse noise in images. Impulse noise, also called the salt and pepper noise, usually occurs in dark and bright regions of the image and the presence of this noise degrades the visual quality of the image by affecting its texture and fine details. Our algorithm first identifies the noisy pixels in image based on 4-connectivity between the processing pixel and adjacent noisy pixels in a chosen window. Based on the region on which the processing is being done, the identified noise is removed and a median filter of varying mask size is used for estimating the correct value. The proposed method is found to be effective in dealing with high density impulse noise and further all the fine details and texture of the image is preserved.

includes both noise and noise free pixels. A connection is established between the noisy pixels alone and based on how many noisy pixels are connected; the processing pixel is determined to be noise or noise free. The proposed algorithm could restore the image even for a noise density of 80%. Many iterative procedures are used to filter the corrupted image and hence image restoration is achieved even in extremely corrupted images.

2. PROPOSED ALGORITHM
For processing according to the proposed algorithm, the image is divided into three regions as black (0), white (255) and gray shade regions (i.e.) intensities other than 0 and 255. The algorithm consists of two phases. The first phase is used for identifying the noisy pixels. This in turn can be divided into two sub stages. In sub stage 1, the noisy pixels in black and white background regions are found and replaced with the correct values. This sub stage involves both noise identification and removal. In sub stage 2, the noisy pixels in gray shade regions are found using the connectivity principle. Pixel connectivity is the means by which each pixel can be related to their neighbours. In this algorithm, 4-connectivity is used. Pixels that are horizontally and vertically adjacent to a pixel is said to be the 4- neighbours of that particular pixel. In the second phase, the noise identified by sub stage 2 is replaced with an estimated value of the correct value. This is done by replacing the noise with the median of specific values contained within a varying window. In general, the second phase is applicable only to sub stage 2 because sub stage 1 performs both noise identification and removal. .

Keywords
Morphology, Connectivity, Impulse noise, Median filter, Mask.

1. INTRODUCTION
Often images are corrupted by impulse noise. This type of noise occurs generally in digital images due to the problems in scanning, video sensor problems, decoding errors, etc. Filtering impulse noise is one of the most important pre processing procedures that has to be done before feature extraction. Generally Median filters are used in removing the impulse noise. Median filter checks the value which is in the centre of the neighbourhood chosen and replaces the centre value with the median value of all those neighbourhood values. Some of the variants of median filter are Adaptive median filter (AMF), Rank order based Adaptive Median Filter (RAMF), Switching median filter (SMF), Decision based filter (DBF), Hybrid median filter (HMF), etc. However in many cases using median filter variants alone is not enough for ensuring the better quality of the filtered image. These filters not only suppress the noise but also affect the noise free pixels and hence, a blurred version of the original image is formed. Hence a different method in dealing with the impulse noise based on morphological image processing is proposed. This approach proves its efficiency for impulse noise removal in digital images by using pixel connectivity procedure. The removal procedure is of two main stages. The first one is noise identification which is followed by image restoration. This algorithm is based on how the noisy pixels are connected together within a particular window. While processing a particular pixel, the chosen window for that pixel

3. PHASE 1- NOISE IDENTIFICATION


Impulse noise candidates are found in this stage. For processing according to our algorithm, first the sub stage in which the pixel must be processed is determined. In fig 1, phase 1 is illustrated using a flowchart.

The steps involved in phase 1 are specified as follows: 1. The processing pixel f(x, y) is extracted along with its neighbourhood pixels. The mask size is chosen according to the noise density

MASK SIZE 3X3 5X5 7X7

NOISE DENSITY 0-30% 30-60% 60- 90%

For increasing noise density, the mask size should also be linearly increased for better noise identification. However increasing the mask size also imposes a blurry effect on the restored image. = + , + , = (2 + 1 2 + 1) 1. The proposed scheme is applied for an 8 bit image (Intensity range-0 to 255). The centre pixel is verified for 0 or 255. If it is one of the two values, then it is retained as a possible candidate for noise. Or else it is considered as noise free and the next pixel along with its neighbourhood is taken for processing. (, ) = 2. 1, , = 0 255 0,

If N(x,y)=1, then the matrix G is checked for values 0 and 255. If all the values in G are 0 and 255, then sub stage 1 is used and if there are different intensity levels (0 to 255), then sub stage 2 is selected for noise identification. = 1, 2, ( 0 |255 = 0

68% of the total area of the curve is always considered as noise for processing according to the algorithm although it may also contain some noisy pixels for higher noise densities. As proposed earlier, pixel connectivity is used to identify a noisy pixel. Hence connectivity is established between the pixels contained within the remaining 32% of the curve. This portion of the curve may also contain some noise free pixels. However, this does not cause significant problem for noise identification. For establishing connectivity, certain conditions are specified based on which the intensity values in the extracted window are changed to either 0 (background pixel) or 1(foreground pixel) and a 4-connectivity is established between the foreground pixels (1). The connection thus established between the foreground pixels is actually a connection among the noisy pixels in the chosen window. This procedure is given in the following steps. 1. A function H is found which is a subset of G with G (centre) removed. Then the mean () and standard deviation () of H is found. From that, two values (R1 and R2) are found. R1=- and R2=+ It is seen that almost all the noise free pixels are contained within this range and the noisy values are located outside the range. However there are certain cases like images with high noise density or regions with intensity values closer to 0 & 255 where the noisy pixels are also included in the range because the mean will be centred around 0 or 255 in either cases. 2. Now the values of H are converted to any of the three values 0, 255 and constant K based on the following conditions. This is based on the assumption that the values contained within the range R are noise free and those outside the range are noise. If R1 is ve and R2 is +ve, then all the values except 0 contained within this range are converted to a constant (k) and the values greater than R2 is converted to 255[con.1]

3.1 Sub stage 1- Image restoration in white and black regions


The window extracted from a white or black region from a noise free image will have all its values as either 0 or 255 .However if impulse noise is present, depending on noise density level, noisy 0 values replace some of the 255 values in white region and vice versa. But the majority of the pixels in a chosen window will be either 0 or 255 based on the region. Hence the no of 0s and 255s in the window is counted and f(x, y) is replaced with the value occurring maximum no of times. , = 0, 255, >

= 0 = 255 s in .

3.2 Sub stage 2- Noise Identification in Gray shade regions


The distribution of pixels in a particular neighbourhood follows nearly a normal distribution with the noise pixels occupying a very less area of the bell shaped curve of normal distribution (i.e.)the noise occupies only both the extremes and the noise free pixels are centred around the mean value of the neighbourhood.

, 1 < < 2 0 = 0, = 0 255, > 2 If R1 is +ve and R2 is +ve but less than 255 (highest possible intensity value), then all the values within this range are converted to a constant K. The values less than R1 are converted to zero and the values greater than R2 are converted to 255.[con.2] 0, < 1 = , 1 < < 2 255, > 2 If R1 is +ve and R2 is +v2 but greater than maximum possible intensity value (255), then all

the values except 255 within the range are converted to a constant K. And the values less than R1 are converted to 0.[con.3] 0, < 1 1 < < 2 255 = , 255, = 255 3. At this stage, the function H contains only the above mentioned three values. Now, the Centre pixel of G (i.e.) f(x, y) is added to H to make it a (2k+1 x 2k+1) matrix. H values are again altered based on f(x, y).

If f(x, y) =255, then all the H values equal to 255 are changed to 1 and all the other values are changed to 0.

3. If f(x, y) =0, first all H values equal to zero are changed to 1 and then all the other values are changed to 0. The order in which the values are changed is important in this case. 4.

All the above conditions and change of values are done only to facilitate finding the connectivity between pixels. The 4- connectivity between foreground pixels (value 1) in matrix H is found (i.e.) no of adjacent pixels (N) connected to the centre pixel is counted.

If this number (N) is greater than a particular value, say A, then the processing pixel is said to be noise free.

If it is less than A, then it is noise. The value A depends on the mask size. For a mask of size( 2k+1 x 2k+1 ), the minimum no of pixels that should be connected together so that the centre pixel is noise free is (k+1)*(2k+1) (, ) = , , >

again incremented by 1 and this increment happens till K. = ( + , + ) , = 0 , = 0,1, and , = ( 0 255 .

4 = + 1 (2 + 1)

5. EXPERIMENTAL RESULTS
Simulations are done on various standard images at different noise levels. The performance of this scheme is measured by using the parameter PSNR and compared with the PSNR values of other methods and is shown that our method is superior to other methods.

4. PHASE 2- NOISE REMOVAL USING MEDIAN FILTER OF VARYING MASK SIZE


Once the pixel has been identified as noise, then it is replaced with an estimated value of the correct intensity level. From the G matrix, certain elements are extracted and then the median of those values are calculated and that median value replaces f(x, y). The steps of phase 2 is shown in Fig.2 1. For a mask of size (2k+1 x 2k+1), the following values are extracted. = ( + , + ) , = 0 1 2. The values other than 0 and 255 are found in f. Then the median of those values is calculated which in turn is the estimated correct value. , = ( 0 255 3. If all the values of f are either 0 or 255, then the upper limit of sand t is incremented by 1. If still the function f has no values other than 0 and 255, then the limit is

The standard images chosen for testing are Lena, Boat and gold hill. All the images are 8 bit gray scale images with size 512x512. The mask size is chosen accordingly to the noise density level. For instance, while testing with Lena image corrupted by impulse noise level of 70%, the mask size chosen is 5x5. This implies that the value of K is 2. Further while identifying a noisy pixel in sub stage 2, the value of A is set as 15. While processing a particular pixel of the image, if the no of adjacent pixels connected to the processing pixel after window modification exceeds 15, then the pixel is determined as noise free. To illustrate the quality of the filtered image, the parameter peak signal to noise ratio (PSNR) is used. The PSNR value found in this case is found to be 30.627 db The results of our experiment are summarised in the following graphs and table. In Fig.3 (a), original Lena image is shown and images corrupted with 70%, 80% noise density and the restored images are shown in latter figs. It is seen that the proposed scheme not only filters out the noise but also preserves the edge and other fine image details. The filtered images also have visually good quality.

Tab.1 shows the PSNR value calculated for Lena image at various noise ratios using different schemes. It is clearly evident from the table that our algorithm is superior to others.

Simulation results of the other images Boat and Gold hill can be seen in Fig.4

[4] T. Nodes and N. Gallagher, Median filters: Some modifications and their properties, IEEE Trans. Acoust., Speech, Signal Process., vol. ASSP-30, no. 5, pp. 739 746, Oct. 1982. [5] W. Luo, An efficient detail-preserving approach for removing impulse noise in images, IEEE Signal Process. Lett., vol. 13, no. 7, pp.413416, Jul. 2006. [6] P. Civicioglu, Using uncorrupted neighbourhoods of the pixels for impulsive noise suppression with ANFIS, IEEE Trans. Image Process., vol. 16, no. 3, pp. 759 773, Mar. 2007 [7] Esakkirajan, S., Veerakumar, T., Subramanyam, A.N. and PremChand, C.H., 2011. Removal of High Density Salt and Pepper Noise Through Modified Decision Based Unsymmetric Trimmed Median Filter, IEEE Signal Processing Letters, vol. 18, no. 5, pp. 287-290. [8] Gonzalez, R.C., and Woods, R.E., 2004. Digital Image processing (2nd edition), Pearson Education. [9] Xin Zangju, Wang Shoujue, Deng Haojiang, Luo Yujing, A new filtering algorithm based on extremum and median value, Journal of Image and Graphics, 2001,6(6),pp.25-28. [10] Gou Zhongkui, Zhang Shaojun, Li Zhongfu, Jin Jian, New adaptive median filter algorithm based on extreme value, Infrared and LaserEngineering, 2005, 34(1), pp.98-101. [11] H. Chan, H. Chung-wa, and M. Mikolova, Salt and pepper noise removal by median type noise detectors and detail-preserving regularization, IEEE Transactions on Image Processing, vol. 14, pp.1479-1485, Oct. 2005. [12] A. K. Jain, Fundamentals of Digital Image Processing, Englewood Cliffs, NJ: Prentice-Hall, 1989.

6. CONCLUSION
A morphological approach based on pixel connectivity is used in dealing with high density salt and pepper noise. Connectivity is established between centre and adjacent pixels and based on how many no of pixels are connected, noise is determined. Performance of this scheme is tested on various standard images. The proposed algorithm gave good results when to compare to others. Further, it is seen that all the texture and edge information of the image is preserved in this method. .

7. REFERENCES
[1] W. K. Pratt, Digital Image Processing. New York: Wiley Interscience, 1991. [2] Toh, K.K.V. and Isa, N.A.M., 2010. Noise Adaptive Fuzzy Switching Median Filter for Salt-and-Pepper Noise Reduction. IEEE Signal Processing Letters, vol. 17, no. 3, pp. 281-284. [3] Nair, M.S., Revathy, K., and Tatavarti, R., 2008. Removal of Salt-and-Pepper Noise in Images: A New Decision-Based Algorithm. In Proceedings of the International MultiConference of Engineers and Computer Scientists, vol. I.

You might also like