Adaptive Switching Median Filter Utilizing Quantized ... - CiteSeerX

1 downloads 0 Views 755KB Size Report
Mar 1, 2012 - in this paper. This method, known as Quantized Adaptive. Switching Median Filter (QASMF), is derived from Simple. Adaptive Median Filter ...
Asian Transactions on Fundamentals of Electronics, Communication & Multimedia (ATFECM ISSN: 2221-4305) Volume 02 Issue 01

Adaptive Switching Median Filter Utilizing Quantized Window Size to Remove Impulse Noise from Digital Images Haidi Ibrahim

Abstract — A new impulse noise reduction filter is proposed in this paper. This method, known as Quantized Adaptive Switching Median Filter (QASMF), is derived from Simple Adaptive Median Filter (SAMF). QASMF is constructed from two main processing blocks. In the first processing block, the damaged image is filtered by using adaptive switching median filter, utilizing quantized window size. The quantization of the window size is carried out based on the number of “noisefree” pixels within a local 33 neighborhood. The second processing block employs SAMF to filter the residual “noise” pixels from the first processing block. The size of the median filter will expand until there are at least eight “noise-free” pixels contained within the filtering window. Experimental results using five standard grayscale test images of size 512512 pixels show that QASMF is able to restore corrupted images, even when the images were highly degraded by impulse noise. As compared with Adaptive Switching Median Filter (ASMF) and SAMF, QASMF has the lowest Mean Square Error (MSE) value at any impulse noise corruption level. QASMF requires less processing time than SAMF if the input images were corrupted by 40% or more impulse noise1. Index Terms — Digital image processing, impulse noise reduction, median filter, adaptive filter.

I. INTRODUCTION Many electronic gadgets on these days are able to capture, store, and transmit digital images. Unfortunately, these digital images are sometimes corrupted by noises, including impulse noise [1]. There are a few factors that can contribute to the impulse noise corruption. These factors include damaged image sensors, malfunction memory location in digital storage, and noisy transmission medium [2]. The impulse noise that is also known as salt-and-pepper noise is quantized into two extreme values, which is either the minimum value, or the maximum value of the image intensity range (i.e. if the image is quantized into L intensity levels, the impulse noise takes either intensity 0 or L-1). The impulse noise corrupts the pixels at random locations [3]. The corrupted pixels normally have high contrast towards their surroundings. As a consequence, the appearance of the image will be changed 1 H. Ibrahim is with the School of Electrical and Electronic Engineering, Engineering Campus, Universiti Sains Malaysia, 14300 Nibong Tebal, Penang, Malaysia (e-mail: [email protected]).

Mar 2012

dramatically by the impulse noise; even if the impulse noise level is low [4]. Digital image processing technique based on median filtering framework is normally been used to decrease the impulse noise level in digital images. Ordinary Median Filter (OMF) is defined as: (1) g ( x, y)  median f (s, t ) ( s ,t )S xy

where f is the input image, g is the corresponding filtered image, and (x,y) are the spatial coordinates of the central pixel within contextual region Sxy defined by a filtering window of size WW pixels. As seen from equation (1), OMF processes all the image pixels, because it does not differentiate between “noise-free” pixels and “noise” pixels. Therefore, OMF removes fine details from the input image, and produces distorted and blurred resultant image [1]. Hence, to overcome this serious problem, many researchers have proposed various improvements to median filter. Unfortunately, most of these suggested improvements require more complex algorithms and longer processing time. Therefore, not all of the proposed median filtering methods are suitable to be implemented for real-time imaging system, or in consumer electronics [5]. One of the branches for the improvement of median filter is based on switching approach. In general, switching median filter divides its implementation into two stages; which are noise detection stage, and noise cancellation stage. During the first stage, by using some of the image characteristics such as pixel intensity, the noise detector algorithms classify the image pixels either “noise” or “noise-free” pixels. Then, in the second stage of the method, only “noise” pixels are processed by the filter, whereas “noise-free” pixels are left unchanged. This condition enables the method to preserve most of the image details [1][6]. Another type of the median based methods is the adaptive median filter. In this framework, the size of the median filter is made adaptable to the local noise content. Smaller filter size is applied at pixel locations with low noise level in order to keep the image details. On the other hand, larger filter size is applied at pixel locations with higher noise level in order to remove the noise successfully. One of the adaptive median methods is known as Simple Adaptive Median Filter (SAMF) [5]. This method employs one rule to make it adaptive towards local noise content. This rule is simple as it only requires the filter to have at least eight “noise-free” pixels before it can calculate the median value at each “noise” pixel’s location. It was shown that SAMF has a better performance in terms of

ATFECM-50203016©Asian-Transactions

1

Asian Transactions on Fundamentals of Electronics, Communication & Multimedia (ATFECM ISSN: 2221-4305) Volume 02 Issue 01

Mean Square Error (MSE) when compared with some state-ofthe-art methods. Modifications of SAMF by introducing weighted median or by using circular filter slightly improve the restoration ability, but significantly increase the required processing time [7]. Another example for adaptive median method is Adaptive Switching Median Filter (ASMF) [8]. ASMF uses a noise detector that works based on both local maximum intensity and local minimum intensity values contained in the contextual region defined by the sliding noise detection window. Similar to SAMF, the size of the noise cancellation window in ASMF depends to the number of “noise-free” pixels surrounding the current “noise”. The main aim of this paper is to propose a method that can reduce the processing time of SAMF. In general, the processing time required by the median filter can be improved by several ways. First, the calculation of the median value is faster by using local intensity histogram than by using sorting algorithm [9][10]. Then, by manipulating the technique to create the local intensity histogram, and the sliding route of the filter, these can significantly reduce the processing time required by the median filter [11]. Yet, these modifications are only suitable to be implemented to non-adaptive median filtering method, because these modifications require constant filter size. Thus, the adaptation of these modifications towards SAMF will be carried out in this paper. This new method is called as Quantized Adaptive Switching Median Filter (QASMF), because it uses quantized window size in its implementation. The organization of this paper is as follows. First, the descriptions on SAMF are given in Section II. Then, QASMF is explained in Section III. Section IV presents the experimental results and discussion. The conclusion derived from this work is given in Section V. II. SIMPLE ADAPTIVE MEDIAN FILTER (SAMF) Simple Adaptive Median Filter (SAMF) is actually a hybrid between the switching median filter with the adaptive median filter [5]. Following the switching median filter framework, the implementation of SAMF can be divided into two main stages; noise detection, and noise cancellation. These two stages are explained in the following subsections. A. Stage 1: Noise Detection During this stage, the image pixels are grouped into two classes, which are “noise-free” and “noise” pixels. The noise detector used by SAMF uses the intensity values to classify the pixels. SAMF assumes that the impulse noise takes intensity value 0 or L-1, for image with L intensity levels. Therefore, the noise pixel candidates are those pixels with intensity value 0 or L-1. Thus, at each pixel location (x,y), a noise mask  is marked using the following equation. 1 : f ( x, y)  0 or f ( x, y)  L  1  ( x, y)   (2) otherwise 0 : where f is the damaged image. If the dimensions of f are MN pixels, then, the global approximation of the impulse noise level  in f is: Mar 2012



M 1 N 1

 ( x, y) /(M  N )

(3)

x 0 y 0

Both  and  will be used in Stage 2 of SAMF. B. Stage 2: Noise Cancellation Consider an ideal situation when we filter one impulse noise using OMF of size 33 pixels, as shown in Fig. 1(a). For this case, the pixel of interest (i.e. the pixel at the center of the contextual region) is a “noise” pixel, and all of its neighboring pixels are the “noise-free” pixels. At this condition, OMF is not only successfully eliminates the impulse noise, but this method also able to replace the pixel of interest with a good restoration value.

(a) Noise = 1/9

(b) Noise = 2/9

(c) Noise = 3/9

(d) Noise = 4/9

(e) Noise = 5/9

(f) Noise = 6/9

(g) Noise = 7/9

(h) Noise = 8/9

(i) Noise = 9/9

Fig. 1. Some possible conditions obtained within 3×3 filtering window. The black pixels present the “noise pixel”, while the white pixels present the “noise-free pixel”. The gray pixel is the pixel of interest, which is also a “noise pixel”.

As shown in Fig. 1, when we use OMF with filtering window 33 pixels, the method only able to replace the pixel of interest with one of the “noise-free” pixel samples, if the number of the “noise” pixel samples is less than half of the area defined by the contextual region (i.e. the “noise” pixel samples are less than five samples, for a contextual region of nine pixels). One of the solutions for this problem is by calculating the median value by using only the “noise-free” pixels. Yet, for the filtering conditions as shown by Fig. 1(g)(i), this approach cannot give a good restoration value. Therefore, in SAMF, the calculation of the median value is carried out not only using the “noise-free” pixels, but also based on the number of the “noise-free” pixels within the contextual region. In SAMF, the filter size at coordinates (x,y) will expand until there are at least eight “noise-free” pixels inside the filtering window. This condition is used to imitate the condition as shown in Fig. 1(a). This simple rule enables the size of the filter used by SAMF to be suited locally, dependent to the local noise level at that position. This is depicted by Fig. 2.

ATFECM-50203016©Asian-Transactions

2

Asian Transactions on Fundamentals of Electronics, Communication & Multimedia (ATFECM ISSN: 2221-4305) Volume 02 Issue 01 TABLE I FILTER SIZE USED BY SAMF TO PROCESS CORRUPTED “LENA” IMAGE Noise Level

A

C

B

Fig. 2. The black pixels present the “noise pixel”, while the white pixels present the “noise-free pixel”. The gray pixel is the pixel of interest, which is also a “noise pixel”. At position A, filter of size 5×5 is used, at position B, filter of size 3×3 is used, while at position C, filter of size 7×7 is used. This example shows that SAMF is able to change its window size accordingly, depending on the local noise content.

Based on the noise mask  obtained from Stage 1, only the “noise” pixels are filtered by SAMF, whereas the “noise-free” pixels are maintained into the output image g. Therefore, g is given as:  f ( x, y) :  ( x, y)  0 g ( x, y)   (4) m( x, y) : otherwise where m is the median value calculated using the method described in the previous paragraph. For the filtering process, SAMF uses square filters of size W×W, where W is an odd number (i.e. W=2R+1). In the case of high level of corruption, the method will take a lot of time to find the suitable filter size. Thus, in order to minimize the number of trials that is needed to find the correct filter size, the minimum value of R (i.e. Rmin) is determined globally, using the value of  from Stage 1.



Rmin  0.5 7 /(1   )



(5)

III. QUANTIZED ADAPTIVE SWITCHING MEDIAN FILTER (QASMF) In order to speed up the process of median value calculation, the usage of the local histogram is employed in SAMF. However, it is almost impossible to implement the method of creating local histograms as described in (Huang et al., 1979) into SAMF. This is due to the filter size used by SAMF is not fixed, and the range of the filter sizes is also not known. However, if we run a simple experiment, which is by using SAMF to process corrupted “Lena” image under several level of impulse noise attack, we can see that SAMF uses filter of size 55 pixels on most of the time. This is shown in Table 1. By using this fact, in QASMF, the selection of filter sizes will be set into limited possibilities. The implementation of QASMF in general can be divided into two main stages. In the first stage, the image is filtered by using a set of quantized filter sizes. However, on the second stage, the filter size will not be fixed. These two stages are described by the following subsections.

Mar 2012

Filter Size Minimum

Maximum

Mode

3×3 3×3 3×3 3×3 3×3 5×5 5×5 7×7

7×7 7×7 7×7 9×9 9×9 11×11 15×15 21×21

5×5 5×5 5×5 5×5 5×5 5×5 7×7 9×9

11.1% (i.e. 1/9) 22.2% (i.e. 2/9) 33.3% (i.e. 3/9) 44.4% (i.e. 4/9) 55.6% (i.e. 5/9) 66.7% (i.e. 6/9) 77.8% (i.e. 7/9) 88.9% (i.e. 8/9)

A. Stage 1: Median Filtering Using Quantized Window Size For an input image f, the pixels are first classified into either “noise-free” pixels or “noise” pixels by using equation (2). Then, by using noise mask  the following value is calculated at every coordinates (x,y):

 ( x, y) 

x 1

y 1

  ( j, k )

(6)

j  x 1 k  y 1

The value of  indicates the number of “noise” pixels within a contextual region defined by a window of size 3×3 pixels. As the window size is fixed to 3×3 pixels, the calculation of  can be made fast by using the local histogram and the method described in [11]. Let denote the output image from the first stage of QASMF as f1. This output image is defined as:  f ( x, y) :  ( x, y)  0 or  ( x, y)  9 f1 ( x, y)   (7) otherwise m( x, y) : This means that image f1 maintains the input values for “noisefree” pixels. Furthermore, this stage also does not process the “noise” pixel, if all of its eight neighboring pixels are also the “noise” pixels as shown in Fig. 1(i) (i.e. (x,y) = 9). On the other hand, when the current pixel is a “noise” pixel and there is at least one “noise-free” pixel within the 3×3 pixels region, QASMF calculates the median value m. The value of m is determined by using “noise-free” pixels, but unlike SAMF, in this stage, QASMF uses a fixed filtering window size as given by the following equation:  3  3 :  ( x, y )  1  W  W  7  7 :  ( x, y )  8 (8) 5  5 : otherwise  This window size quantization process, as given by equation (8), is decided based on Fig. 1 and the mode of the filter size in Table 1. As the sizes of the filter are now known, the method as described in [11] has been used in order to speed up the filtering process. In this implementation, for each location (x,y), three local histograms are updated simultaneously, corresponding to the filters of size 3×3 pixels, 5×5 pixels and 7×7 pixels.

ATFECM-50203016©Asian-Transactions

3

Asian Transactions on Fundamentals of Electronics, Communication & Multimedia (ATFECM ISSN: 2221-4305) Volume 02 Issue 01

B. Stage 2: Residual Impulse Noise Filtering using SAMF In this stage, the output from Stage 1 (i.e. f1) is fed as the input to SAMF filter, described in Section 2. However, equation (2) is replaced by the following equation: 1 :  ( x, y)  9 (9)  ( x, y)   0 : otherwise This change is done because the main aim of this stage is to filter out the remaining “noise” pixels that are not filtered during Stage 1 (i.e. (x,y) = 9). Because most of the pixels are now already filtered by Stage 1, the noise density in f1 is much lower when compared with the original corrupted image f. Therefore, STEP 1 of QASMF helps the algorithm to find the correct window size in easier and faster way.

from the impulse noise, and are shown in Fig. 3. In order to get the corrupted image versions f, these images are contaminated with Q% of impulse noise. To benchmark the performance of QASMF, two other median filtering methods have been implemented in this work. They are SAMF [5] and ASMF [8]. The performance of the filtering techniques is judged from the Mean Square Error (MSE) value, processing time, and the visual appearance of the resultant images. MSE is used as an indicator to the restoration performance. This measure is defined as:  M 1 N 1  (10)  MSE   g ( x, y )  e( x, y) 2  / M  N     x 0 y 0  Small MSE value indicates that the restored image is very similar to its original uncorrupted image version. Therefore, a small MSE value is expected from the noise filtering method.



IV. EXPERIMENTAL RESULTS AND DISCUSSIONS

(a) “Airplane”

(b) “Sailboat”

Fig. 4. The graph of the average MSE value, calculated from five test images, versus the noise level.

(c) “Peppers”

Fig. 4 shows the average MSE value versus the noise level, obtained by using the five test images shown in Fig. 3. This graph indicates that ASMF is always producing higher MSE values when compared with SAMF and QASMF. The MSE values obtained from QASMF are almost equal to the MSE values by SAMF for low levels of corruption. However, the MSE value from QASMF is lower than SAMF when the corruption level is high.

(d) “Baboon” (e) “Lena” Fig. 3. The five standard test images used in this work for the evaluation purpose.

In this paper, five standard grayscale images of size 512×512 pixels (i.e. L = 256 intensity levels) have been used as the test images. These test images, denoted as e, are considered free

Fig. 5. The graph of the average processing time (in milliseconds), calculated from five test images, versus the noise level.

Fig. 5 shows the graph of the average processing time Mar 2012

ATFECM-50203016©Asian-Transactions

4

Asian Transactions on Fundamentals of Electronics, Communication & Multimedia (ATFECM ISSN: 2221-4305) Volume 02 Issue 01

versus the noise level, obtained by using the five test images. This figure shows that the processing time required by ASMF is almost constant, regardless to the noise level. On the other hand, the processing time required by SAMF and QASMF are increasing, when the noise level is increasing. This figure also shows that when the noise level is less than 40%, the processing time required by QSAMF is higher than the one required by SAMF. The main reason for this situation is because QSAMF still needs to update its three local histograms in Stage 1, even the majority of the pixels of the image are the “noise-free” pixels. As a consequence, this wastes some of the processing time. On the other hand, when QASMF restores highly corrupted image corrupted (e.g. noise level of 80% or 90%), the processing time required by QASMF is almost half than what is required by SAMF. This significant reduction in processing time is mostly due to the use of smaller filter sizes in QASMF. Furthermore, in Stage 2 of QASMF, the filter is not expanding much as compared with SAMF. In order to judge the appearance of the resultant images, some of the output images are shown in Fig. 6 to Fig. 8. As shown by these figures, all methods are able to remove impulse noise up to noise level of 90%. These figures also show that the results from QASMF are sharper than the results from SAMF. This is mainly because QASMF uses smaller filters as compared with SAMF, and therefore, QASMF has a better local content preservation.

known as QASMF filter, has been introduced. QASMF produces lowest MSE values at most of the noise corruption level. Furthermore, QASMF requires shorter processing time than SAMF when it processes images with high density of impulse noise. QSAMF also has better local content preservation ability due to the usage of small filter sizes.

(a)

(b)

(c) (d) Fig. 7. (a) “Peppers” corrupted by 50% of impulse noise (MSE = 9604.67). (b) The output from ASMF (MSE = 97.96). (c) The output from SAMF (MSE = 56.26). (d) The output from the proposed method, QASMF (MSE = 56.07).

(a)

(b)

(a)

(c) (d) Fig. 6. (a) “Airplane” corrupted by 10% of impulse noise (MSE = 2121.20). (b) The output from ASMF (MSE = 24.29). (c) The output from SAMF (MSE = 11.07). (d) The output from the proposed method, QASMF (MSE = 11.04).

V. CONCLUSION In this paper, an improved version of SAMF filter, which is Mar 2012

(b)

(c) (d) Fig. 6. (a) “Lena” corrupted by 90% of impulse noise (MSE = 16714.70). (b) The output from ASMF (MSE = 202.89). (c) The output from SAMF (MSE = 197.18). (d) The output from the proposed method, QASMF (MSE = 176.95).

ATFECM-50203016©Asian-Transactions

5

Asian Transactions on Fundamentals of Electronics, Communication & Multimedia (ATFECM ISSN: 2221-4305) Volume 02 Issue 01

ACKNOWLEDGMENT The author would like to thank Mr. Nicholas Sia Pik Kong for his helpful discussions. This work was supported in part by the Universiti Sains Malaysia’s Short Term Research Grant with account number 304/PELECT/60311013. REFERENCES Wenbin Luo, “Efficient removal of impulse noise form digital images”, IEEE Trans. Consumer Electronics, vol. 52, no. 2, pp. 523-527, May 2006. [2] Raymond H. Chan, Chung-Wa Ho, and Mila Nikolova, “Salt-andpepper noise removal by median-type noise detectors and detail preserving regularization”, IEEE Trans. Image Processing, vol. 14, no. 10, pp. 1479-1485, October 2005. [3] Rafael C. Gonzalez, and Richard E. Woods, “Digital Image Processing”, 2nd Edition, Prentice Hall, 2002. [4] Jung-Hua Wang, and Lian-Da Lin, “Improved median filter using minmax algorithm for image processing”, Electronics Letters, vol. 33, no. 16, pp. 1362-1363, July 1997. [5] Haidi Ibrahim, Nicholas Sia Pik Kong, and Theam Foo Ng, “Simple adaptive median filter for the removal of impulse noise from highly corrupted images”, IEEE Trans. Consumer Electronics, vol. 54, no. 4, pp. 1920-1927, November 2008. [6] Kenny Kal Vin Toh, Haidi Ibrahim, and Muhammad Nasiruddin Mahyuddin, “Salt-and-pepper noise detection and reduction using fuzzy switching median filter”, IEEE Trans. Consumer Electronics, vol. 54, no. 4, November 2008. [7] Nicholas Sia Pik Kong, and Haidi Ibrahim, “The effect of shape and weight towards the performance of simple adaptive median filter in reducing impulse noise level from digital images”, In Proceedings of the 2nd International Conference on Education Technology and Computer (ICETC 2010), vol. 5, pp. 118-121, June 2010. [8] Z. Q. Cai, and Tracey K. M. Lee, “Adaptive switching median filter”, In Proceedings of the 7th International Conference on Information, Communications and Signal Processing (ICICS 2009), pp. 1-4, December 2009. [9] Haidi Ibrahim, Theam Foo Ng, and Sin Hong Teoh, “An efficient implementation of switching median filter with boundary discriminative noise detection for image corrupted by impulse noise”, Scientific Research and Essays, vol. 6, no. 26, pp. 5523-5533, November 2011. [10] Nicholas Sia Pik Kong, and Haidi Ibrahim, “Multiple layers block overlapped histogram equalization for local content emphasis”, Computers and Electrical Engineering, vol. 37, no. 5, pp. 13-18, September 2011. [11] Thomas S. Huang, George J. Yang, and Gregory Y. Tang, “A fast twodimensional median filtering algorithm”, IEEE Trans. Acoustics, Speech and Signal Processing, vol. 27, no. 1, pp. 13-18, February 1979. [1]

Mar 2012

ATFECM-50203016©Asian-Transactions

6

Suggest Documents