Images are often corrupted by impulse noise during acquisition and transmission. Therefore, an efficient noise suppression method is required before subsequent image processing operations . Many recent methods [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
first detect the corrupted pixels and then restore them without affecting the uncorrupted pixels. Various solutions for estimating the intensity of noisy pixels can be divided into four categories of median-based filters, fuzzy-based algorithms, adhoc ideas and weighted-average filters.
Most of impulse noise removal algorithms are variations of median filtering. Best examples are Decision-Based Algorithm (DBA) , Median-based Switching filter (MS) , and Modified Decision Based Unsymmetric Trimmed Median Filter (MDBUTMF) . Also, due to the nature of impulse noise, some methods are proposed based on fuzzy logics, such as Detail-Preserving Filter (DPF) , Noise Adaptive Fuzzy Switching Median (NAFSM) filter 
, and Turbulent Particle swarm optimization based Fuzzy Filtering (TPFF).
Other methods employed different ideas. In , Specialized Regularization (SR) method is proposed to restore noisy pixels. Opening-Closing Sequence (OCS) filter is presented in  based on mathematical morphology. In , Edge-Preserving Algorithm (EPA) is proposed which adopts a directional correlation-dependent filtering technique. In , Robust Outlyingness Ratio is combined with the Non-Local Means (ROR-NLM) to detect and filter the noisy pixels. In , a method is presented which employs an iterative impulse detector and an Adaptive Iterative Mean (AIM) filter to remove the general fixed-valued impulse noise.
Another well-known approach is weighted-average filtering, which exploits the correlation among neighboring pixels to restore the corrupted pixels. The Switching-based Adaptive Weighted Mean (SAWM) filter  and the Cloud Model (CM) filter  employ this approach for impulse suppression. Both filters adaptively determine the filtering window and use complex weighting rules. In SAWM method, the weights are specified based on the degree of compatibility between pixels, and the CM filter uses the certainty degrees of uncorrupted pixels as their weights. These filters are time-varying; that is they have to perform pixel-by-pixel restoration, rather than processing the image as a whole. This constraint opposes efficient implementation.
In this paper, we propose a two-step method for real-time impulse noise suppression. First, we employ an impulse detector to identify the corrupted pixels. It examines the spatial correlation of suspicious image pixels to decrease the false detection of uncorrupted pixels as corrupted. Second, we restore the image using a weighted-average filter. The filter operates on the nearest neighboring interpolated image and can be implemented using matrix-based operations.
The rest of this paper is organized as follows. Section II defines the impulse noise model. The method is presented in section III. The experimental results and comparisons are provided in section IV and section V concludes the paper.
Ii Impulse Noise Model
Fixed-Valued Impulse Noise (FVIN), also known as Salt-and-Pepper Noise (SPN), is commonly modeled by:
where , and are the original and corrupted images and noise density, respectively, and is the image coordinate. This model implies that the pixels are randomly corrupted by two fixed extreme grey-values, and , with the same probability.
For impulse noise suppression, we first specify the impulse values and locate the corrupted pixels, and then estimate their original values using the information provided by the uncorrupted pixels.
Iii The Proposed Method 
The proposed noise suppression method consists of two steps: Impulse Detection and Image Restoration. Each step is further discussed in the following.
Iii-a Impulse Detector
To identify the corrupted pixels, we first determine the impulse values, and . However, marking all pixels with an extreme grey-value as noisy pixels results in a false detection of some uncorrupted pixels as corrupted. Therefore at the next step, we should locate the noisy pixels by discriminating the uncorrupted pixels which have an impulse value. For this, we use the fact that SPN alters the pixel values to one of the two extreme grey-values with equal probabilities. Thus, a strong inclination toward one of the impulse values in a neighborhood indicates that there are some uncorrupted pixels with an impulse value. We examine the inclination for each neighborhood and the correlation of each suspicious pixel with its neighbors to distinguish between the corrupted pixels and the uncorrupted ones which have one of the impulse values.
Computing the window size: Given the estimated noise probability is , for a pixel the probability of being uncorrupted is approximately
. Thus, using binomial distribution, the expected number of uncorrupted pixels in a window of sizeis
. If we set this value equal to five, the window size is obtained as the smallest odd integer greater than. The window size is specified such that the expected number of uncorrupted pixels in the pixels’ neighborhood becomes five, and, as a result, there would be enough uncorrupted pixels to examine the center pixel.
We describe the details of the impulse detector in the following:
Specify the impulse values, and , by finding the two extreme grey-values of the corrupted image, and then construct the set as:
where the symbol denotes the logical OR. The set includes the indices of suspicious pixels, i.e. pixels with one of the impulse values.
Compute the estimated noise probability as the rate of the suspicious pixels and set equal to the smallest odd integer greater than .
Compute and as the number of pixels, in the neighborhood of the pixel at coordinate , with grey-values equal to and , respectively.
Construct the sets and as follows:
where the symbol denotes logical AND.
Compute the set of corrupted pixels as:
where and denotes the intersection and union operations, respectively, and stands for the complement set of .
All of its neighbors have values equal to the impulse values,
The majority of its neighbors is inclined to one of the impulse values,
It contributes in this inclination.
We define the mask matrix, corresponding to the set of corrupted pixels , as:
After impulse detection, we rename the uncorrupted and corrupted pixels as known and noisy pixels, respectively.
Iii-B Image Restoration
For image restoration, we propose an Efficient Weighted-Average (EWA) filter. In the proposed method, first we construct an initial image using the Nearest Neighboring Interpolation (NNI). In this image, each noisy pixel takes the grey-value of its nearest known pixel. We then improve the initial image by employing a weighted-average filter, which applies different procedures for weighting the known and noisy pixels.
Note that in this subsection, all multiplications and divisions are pixel-wise.
Iii-B1 Weight Assignment Procedures
The weight assignment procedures are described in this following.
Weights of Known Pixels
The weight assignment to known pixels is based on the fact that due to the spatial correlation of image pixels, the information of adjacent pixels overlaps. In other words, two separate pixels have more information than two adjacent pixels. This confirms the observations that, with a fixed noise density, random losses can be restored better than block/burst losses .
Therefore, to quantify the value of unique information in each known pixel, we should determine the solitariness of that pixel. For this, we define the Information Matrix (IM) as follows:
where * denotes the convolution operation, is the convolution kernel, which is an all one matrix of size , and Mask is obtained from (6).
The denominator of (7) represents a matrix, which elements specify the number of known pixels in the neighborhood of the corresponding image pixel. The set of neighboring pixels is determined by the kernel . The center pixel is also included in the set of neighboring pixels to avoid infinite information value for a solitary known pixel.
Finally, the weights of known pixels are computed as:
The weights are normalized such that the lowest weight for known pixels is one. Therefore, the range of is between 1 and 9. Note that these values are not valid in the positions of noisy pixels.
Weights of Noisy Pixels
The weight assignment to noisy pixels is based on this image property that farther image pixels have lesser correlation with each other. Thus in the initial image, noisy pixels which are farther from their nearest known pixel take less accurate value.
We compute the Distance Transform of the image to obtain the Distance Matrix (DM) and the Closest-Pixel Map (CPM). Each element of DM and CPM contain the Euclidean distance of the corresponding image pixel with the nearest known pixel and the index of that pixel, respectively.
The weights of noisy pixels are computed as:
Equation (9) implies that is inversely proportional to the DM and is set to be in the range of .
One key factor for fast restoration is matrix implementation. The proposed filter has the advantage that all steps are implemented using matrix-based operations. The implementation details of the restoration stage are described in the following:
Compute the matrices DM and CPM from the corrupted image . For computing the Euclidean distance transform, we used the fast algorithm described in .
Using the CPM, employ NNI on the image to obtain the initial image .
Construct the overall Weight Matrix (WM) as:
Restore the image as:
Figure 1 depicts the proposed filter of the restoration stage.
Iii-C Computational Complexity
In this subsection, we compute the complexity of restoring an image from r% SPN, using the EWA filter. The major complexity of the proposed filter is for processing NNI, three convolutions, three pixel-wise multiplications and three pixel-wise divisions. The complexity of NNI is . Also, we implement the convolution by two-dimensional FFT (FFT2) using the following relation:
The complexity of FFT2 is . As a result, the complexity of computing the two-dimensional convolution of an image with a kernel matrix is approximately . Finally, division and multiplication have the complexity of . Therefore, regardless of the noise density, the overall complexity is .
Iv Simulation Results
The proposed algorithm is compared with the best existing methods for SPN removal. Comparisons include the quantitative evaluation, the visual quality and the time complexity. Simulations are run on four grey-scale test images Lena, Peppers, Boat and Bridge. The Peak Signal-to-Noise Ratio (PSNR) is employed for objective performance assessment. To make a reliable comparison, each method is run 20 times with different impulse noise patterns and the result is obtained by averaging over all experiments.
In section I, we divided the SPN removal methods into four categories. For the sake of brevity, in simulations, we compare the proposed method with the best method of each category. For median-based filters, fuzzy-based algorithms, ad-hoc ideas and weighted-average filters, DBA , TPFF , EPA  and SAWM  have the best results, respectively.
Figure 6 depicts the restoration results of different methods for different images corrupted by SPN with various noise densities. The results demonstrate that the EWA filter performs better than other methods. Figures 11-16 exhibit the restored images of the three best filters for images Lena and Bridge corrupted by 80% and 90% SPN, respectively. Clearly, the proposed method outperforms other methods in preserving the image details. Also, Table I lists the running time of the most competitive filters in the MATLAB environment. The simulation results verify that the proposed filter is very efficient for high density impulse noise removal.
In this paper, we proposed a method for fast impulse noise removal from images. The proposed filter first constructs an initial image using the nearest neighboring interpolation and then improves it by employing a weighted-average filter, which applies different procedures for weighting the known and noisy pixels. Experimental results verify that the proposed method outperforms the best existing methods in both qualitative and quantitative measures and is quite suitable for real-time applications.
-  A. Bovik, Handbook of Image and Video Processing. Academic Press, 2000.
-  R. Chan, C.-W. Ho, and M. Nikolova, “Salt-and-pepper noise removal by median-type noise detectors and detail-preserving regularization,” Image Processing, IEEE Transactions on, vol. 14, no. 10, pp. 1479–1485, Oct 2005.
-  K. S. Srinivasan and D. Ebenezer, “A new fast and efficient decision-based algorithm for removal of high-density impulse noises,” Signal Processing Letters, IEEE, vol. 14, no. 3, pp. 189–192, March 2007.
-  D. Ze-Feng, Y. Zhou-ping, and X. You-lun, “High probability impulse noise-removing algorithm based on mathematical morphology,” Signal Processing Letters, IEEE, vol. 14, no. 1, pp. 31–34, Jan 2007.
-  P.-Y. Chen and C.-Y. Lien, “An efficient edge-preserving algorithm for removal of salt-and-pepper noise,” Signal Processing Letters, IEEE, vol. 15, pp. 833–836, 2008.
-  M. Yildirim, A. Basturk, and M. Yuksel, “Impulse noise removal from digital images by a detail-preserving filter based on type-2 fuzzy logic,” Fuzzy Systems, IEEE Transactions on, vol. 16, no. 4, pp. 920–928, Aug 2008.
-  X. Zhang and Y. Xiong, “Impulse noise removal using directional difference based noise detector and adaptive weighted mean filter,” Signal Processing Letters, IEEE, vol. 16, no. 4, pp. 295–298, April 2009.
-  K. Toh and N. Isa, “Noise adaptive fuzzy switching median filter for salt-and-pepper noise reduction,” Signal Processing Letters, IEEE, vol. 17, no. 3, pp. 281–284, March 2010.
-  A. Fabijańska and D. Sankowski, “Noise adaptive switching median-based filter for impulse noise removal from extremely corrupted images,” Image Processing, IET, vol. 5, no. 5, pp. 472–480, August 2011.
-  S. Esakkirajan, T. Veerakumar, A. Subramanyam, and C. PremChand, “Removal of high density salt and pepper noise through modified decision based unsymmetric trimmed median filter,” Signal Processing Letters, IEEE, vol. 18, no. 5, pp. 287–290, May 2011.
-  B. Xiong and Z. Yin, “A universal denoising framework with a new impulse detector and nonlocal means,” Image Processing, IEEE Transactions on, vol. 21, no. 4, pp. 1663–1675, April 2012.
-  Z. Zhou, “Cognition and removal of impulse noise with uncertainty,” Image Processing, IEEE Transactions on, vol. 21, no. 7, pp. 3157–3167, July 2012.
-  H.-H. Chou, L.-Y. Hsu, and H.-T. Hu, “Turbulent-pso-based fuzzy image filter with no-reference measures for high-density impulse noise,” Cybernetics, IEEE Transactions on, vol. 43, no. 1, pp. 296–307, Feb 2013.
-  H. Hosseini and F. Marvasti, “Fast restoration of natural images corrupted by high-density impulse noise,” EURASIP J. Image and Video Processing, 2013.
-  H. Hosseini. (2014) Ewa implementaion, source code and results. [Online]. Available: https://github.com/HosseinHosseini/EWA
-  P. Ferreira, “Iterative and noniterative recovery of missing samples for 1-d band-limited signals,” in Nonuniform Sampling, ser. Information Technology: Transmission, Processing, and Storage, F. Marvasti, Ed. Springer US, 2001, pp. 235–281. [Online]. Available: http://dx.doi.org/10.1007/978-1-4615-1229-5_5
-  J. Maurer, C.R., R. Qi, and V. Raghavan, “A linear time algorithm for computing exact euclidean distance transforms of binary images in arbitrary dimensions,” Pattern Analysis and Machine Intelligence, IEEE Transactions on, vol. 25, no. 2, pp. 265–270, Feb 2003.