Median Filtering Using First-Order and Second-Order Neighborhood Pixels to Reduce Fixed Value Impulse Noise from Grayscale Digital Images

: It is essential to restore digital images corrupted by noise to make them more useful. Many approaches have been proposed to restore images a ﬀ ected by ﬁxed value impulse noise, but they still do not perform well at high noise density. This paper presents a new method to improve the detection and removal of ﬁxed value impulse noise from digital images. The proposed method consists of two stages. The ﬁrst stage is the noise detection stage, where the di ﬀ erence values between the pixels and their surrounding pixels are computed to decide whether they are noisy pixels or not. The second stage is the image denoising stage. In this stage, the original intensity value of the noisy pixels is estimated using only their ﬁrst-order and second-order neighborhood pixels. These neighboring orders are based on the Euclidean distance between the noisy pixel and its neighboring pixels. The proposed method was evaluated by comparing it with some of the recent methods using 50 images at 18 noise densities. The experimental results conﬁrm that the proposed method outperforms the existing ﬁlters, excelling in noise removal capability with structure and edge information preservation.


Introduction
Digital images have an important role in our life [1]. Digital imaging has a wide range of applications in many research areas, such as medical sciences, biology, particle physics, geology, the science of materials, photography and remote sensing [1][2][3]. For some medical practices, digital imaging plays an important role, especially for studying physiology abnormalities and anatomy of the internal organs [4]. Countless images are made, translated and edited daily [5].
However, many images that are created have some imperfections called noise [6]. Such imperfections may be caused by the incapacity and instability of imaging systems or sensors to obtain ideal images [1], or natural disruptions in the surroundings during image processing [1,7], inadequate illumination, or sensor temperature resulting in noise, or during compression and transmission [1,7,8]. Data obtained with these noises can make the data unusable or lose confidence in them [1,9].
Noise is simply an unnecessary detail, impacting the consistency of the signals and data [10,11]. This is because noise results in alterations in images where the original values of some pixels are changed to different values [5]. One of the common types of noise is impulse noise [12]. Impulse noise frequently distorts the image during the phase of image processing and transmission [11,13]. Impulse noise can be divided into two categories, which are random value impulse noise and fixed value impulse noise [13][14][15]. Random value impulse noise is usually caused by errors in timing or

Related Works
Many methods were proposed to enhance SwMF. For example, in work by Samantaray et al. [34], a variable threshold detector (VTD) was used, where the threshold value was dependent on the estimated noise density. The noise density was estimated by sliding an 11 × 11 mask over all the image regions. For each mask having a non-extreme intensity pixel at its center, the method counts the number of pixels with extreme intensity within this area. Then, the noise density was estimated by dividing this number of extreme intensity pixels by the number of the mask's positioning over the entire image. To restore the noisy pixels, Samantaray et al. [34] proposed a neighborhood-based decision filter (NBDF), where only the first-order neighborhood (FON) pixels were used to estimate the original intensity value of the noisy pixel.
In work by Chen et al. [22], the 3σ and local statistics principal (D3PLS) distinguish the noisy pixels and the noise-free pixels in the corrupted image. For the restoration of the noisy pixels, Chen et al. [22] proposed an adaptive sequentially weighted median filter (ASWMF). The median value of the weighted noise-free pixels in a small window is used as the new value of the noisy pixels. If all the pixels in the window are noisy pixels, the window is enlarged until there is at least one noise-free pixel, or it reaches its maximum size.
In work by Chen et al. [35], a fixed threshold detector (FTD) was used, where the number of pixels having the same intensity value as the pixel to be checked in a window of size 5 × 5 determines whether the pixel is noisy or not. In the work by Chen et al. [35], iterative grouping median filter (IGMF) was proposed to restore the noisy pixels. The uncorrupted pixels within a window of size 5 × 5 pixels were arranged in ascending or descending order. They are then divided into groups as the number of edges is found by applying a threshold value between each pixel and its adjacent pixel.
In work by Sangave and Jain [12], a boundary discriminative noise detector (BDND) is used to discriminate the noisy pixels in the corrupted image. The pixels in a window of size 21 × 21 pixels were divided into two groups of equal number, after ascending sort. The two boundaries determined by the pixel intensity value had the largest difference in value with the intensity value of the next pixel to it in each group. After that, to restore the noisy pixels, Euclidean distance filter (EDF) was used, where the original intensity value of a noisy pixel was estimated by the mean value of the noise-free pixels in a window of size w × w pixels after being weighted by the Euclidean distance.

The Proposed Method
In this work, we aim to generate a restored image R from the image C corrupted by fixed value impulse noise. The proposed method is based on SwMF. Therefore, the proposed method consists of two stages, with the first stage being the noise detection stage, and the second stage being the image denoising stage. This is shown in Figure 1. In the noise detection stage, each pixel in the corrupted image C will be denoted as either a noisy pixel or noise-free pixel. This information will be stored in a noise mask N. Then, in the image denoising stage, those pixels denoted as noisy pixels in noise mask N will undergo the process to estimate their original intensity value. The result is the restored image R.

Related Works
Many methods were proposed to enhance SwMF. For example, in work by Samantaray et al. [34], a variable threshold detector (VTD) was used, where the threshold value was dependent on the estimated noise density. The noise density was estimated by sliding an 11 × 11 mask over all the image regions. For each mask having a non-extreme intensity pixel at its center, the method counts the number of pixels with extreme intensity within this area. Then, the noise density was estimated by dividing this number of extreme intensity pixels by the number of the mask's positioning over the entire image. To restore the noisy pixels, Samantaray et al. [34] proposed a neighborhood-based decision filter (NBDF), where only the first-order neighborhood (FON) pixels were used to estimate the original intensity value of the noisy pixel.
In work by Chen et al. [22], the 3σ and local statistics principal (D3PLS) distinguish the noisy pixels and the noise-free pixels in the corrupted image. For the restoration of the noisy pixels, Chen et al. [22] proposed an adaptive sequentially weighted median filter (ASWMF). The median value of the weighted noise-free pixels in a small window is used as the new value of the noisy pixels. If all the pixels in the window are noisy pixels, the window is enlarged until there is at least one noise-free pixel, or it reaches its maximum size.
In work by Chen et al. [35], a fixed threshold detector (FTD) was used, where the number of pixels having the same intensity value as the pixel to be checked in a window of size 5 × 5 determines whether the pixel is noisy or not. In the work by Chen et al. [35], iterative grouping median filter (IGMF) was proposed to restore the noisy pixels. The uncorrupted pixels within a window of size 5 × 5 pixels were arranged in ascending or descending order. They are then divided into groups as the number of edges is found by applying a threshold value between each pixel and its adjacent pixel.
In work by Sangave and Jain [12], a boundary discriminative noise detector (BDND) is used to discriminate the noisy pixels in the corrupted image. The pixels in a window of size 21 × 21 pixels were divided into two groups of equal number, after ascending sort. The two boundaries determined by the pixel intensity value had the largest difference in value with the intensity value of the next pixel to it in each group. After that, to restore the noisy pixels, Euclidean distance filter (EDF) was used, where the original intensity value of a noisy pixel was estimated by the mean value of the noise-free pixels in a window of size w × w pixels after being weighted by the Euclidean distance.

The Proposed Method
In this work, we aim to generate a restored image R from the image C corrupted by fixed value impulse noise. The proposed method is based on SwMF. Therefore, the proposed method consists of two stages, with the first stage being the noise detection stage, and the second stage being the image denoising stage. This is shown in Figure 1. In the noise detection stage, each pixel in the corrupted image C will be denoted as either a noisy pixel or noise-free pixel. This information will be stored in a noise mask N. Then, in the image denoising stage, those pixels denoted as noisy pixels in noise mask N will undergo the process to estimate their original intensity value. The result is the restored image R.

Noise Detection Stage
This method aims to remove fixed value impulse noise only. For this type of impulse noise, all corrupted pixels in image C have extreme intensity values (i.e., 0 or L-1), where L is the number of

Noise Detection Stage
This method aims to remove fixed value impulse noise only. For this type of impulse noise, all corrupted pixels in image C have extreme intensity values (i.e., 0 or L-1), where L is the number of intensity levels of the image (e.g., for an eight-bit-per-pixel grayscale image, L is equal to 256 levels). Therefore, all pixels in image C that have non-extreme intensity values will be denoted as noise-free pixels. On the other hand, initially, all pixels in image C having extreme intensity value will be denoted as noise candidate pixels. However, some of the pixels with the extreme intensity value are not noisy pixels. As a consequence, in this work, noise candidate pixels will be further undergoing the detection stage to distinguish which of them are noisy pixels, and which ones are noise-free pixels.
As mentioned in work by Chen et al. [22], it is assumed that the intensity distribution of the uncorrupted pixels within a local window usually follows a normal distribution. This means that the intensities in the local window have a small difference in value between each other. Hence, the noise-free pixels with extreme values are normally surrounded by pixels that have the same or similar intensity values (i.e., with a small difference in value) to them. From these assumptions, the proposed detector considers that the noise candidate pixel's intensity is significantly different from the neighboring pixels as a noisy pixel. On the other hand, if the intensity value of the noise candidate pixel is similar to its neighboring pixels, this pixel is considered as a noise-free pixel.
Based on that, two threshold values will be used to evaluate the intensity differences between the noise candidate pixel with its neighboring pixels. The first threshold value is the highest difference value (HDV), and the second threshold value is the highest mean value (HMV) of the difference values. Both HDV and HMV will be determined from a set of training images. The training image T r is considered a clean image without noise.
HDV will be calculated by taking the intensity differences between normal extreme intensity (NEI) pixels, which are the pixels having extreme intensity value in image T r , with all of their surrounding pixels, within a window of size 3 × 3 pixels. These difference values will be obtained from all training images that will be used in this work. As the dynamic range is from 0 to 255, the difference values will be grouped and each group will be of 10 difference values. The groups having less than 6% repetitive rate will be denoted as infrequent difference values and will be excluded. Then, the largest intensity difference that is obtained after excluding the infrequent values will be the HDV.
On the other hand, HMV will be calculated by taking the mean values of the difference values between each NEI in image T r and its surrounding pixels within a window of size 3 × 3 for all original images. The infrequent mean values will be excluded. The mean values having less than 2% will be denoted as infrequent mean values and will be excluded. The highest mean value after excluding the infrequent values will be the HMV.
Based on that, the proposed detector denotes noise candidate pixels on an image as noisy pixels or noise-free pixels depending on either of those two threshold values. First, the difference value between the intensity value of the pixel will be checked with the intensity values of the pixels surrounding that pixel, as these difference values will be compared with HDV. Second, the mean value of all the difference values between the noise candidate pixel and its surrounding pixels, as this value, will be compared with HMV.
After that, each noise candidate pixel will be compared with all non-extreme intensity pixels surrounding it in a window of size 3 × 3 pixels. If any difference value is bigger than HDV, the noise candidate pixel will be denoted as a noisy pixel. Otherwise, the mean value of all the difference values will be computed. The difference value between noise candidate pixels and extreme intensity pixels will be constant. For the opposite extreme intensity pixels than the noise candidate pixel, the difference will be equal to the HDV value. For the pixels having the same extreme intensity value as the noise candidate pixel, the difference will equal to 0. If the mean value of the difference values is bigger than HMV, the noise candidate pixel will be denoted as a noisy pixel, otherwise as a noise-free pixel.
If all the pixels surrounding the noise candidate pixel have extreme-intensity values, the fixed threshold detector will be used. For the fixed threshold detector, a window of size 5 × 5 pixels and a threshold of 21 will be used, as recommended in the work by Chen et al. [22]. The number of pixels having the same intensity as the noise candidate pixel will be counted in a window of size 5 × 5 pixels. If the number counted is bigger than the threshold, the noise candidate pixel will be denoted as a noise-free pixel, otherwise as a noisy pixel.
The following eight steps are presented to summarize the procedure: Step 1: Initialize all pixels as noise-free pixels by making all elements in matrix N equal to 0.
Step 2: Denote all pixels having extreme intensity value as noise candidate pixel P NC .
where (x,y) are the spatial coordinates, and C(x,y) is the intensity value of the corrupted image at coordinates (x,y). P NC (x,y) equal to 1 is used to indicate that the pixel is a noise candidate pixel, whereas P NC (x,y) equal to 0 is used to indicate that the pixel is noise-free.
Step 3: For each P NC (x,y) equal to 1, compute the intensity difference values between this pixel with each of its neighboring pixels within a 3 × 3 window, with coordinates (x,y) at the center of that window. These difference values are stored in vector D.
Step 4: If all the neighboring pixels have the same intensity with the center pixel, which is i D(i) = 0, go to Step 6. Otherwise, compare all values in D with HDV value. If any value in D is bigger than HDV, the pixel at these coordinates is denoted as a noisy pixel. Thus, N(x,y) is given the value 1 and go to Step 8. Otherwise, go to Step 5.
Step 5: Replace any element in D which is equal to 255 with HDV value. Then, compute the mean value of the elements in the updated D. If the mean value is greater than HMV, P NC is denoted as a noisy pixel (i.e., N(x,y) = 1), otherwise as a noise-free pixel (i.e, N(x,y) = 0), then go to Step 8.
Step 6: Count the number of pixels that have the same intensity as P NC (x,y) within a window of size 5 × 5 pixels, with coordinates (x,y) at the center of the window. Save this count as Cs.
Step 8: Repeat the steps from Step 3 to Step 8 for all P NC .

Image Denoising Stage
The proposed image denoising stage is based on the work by Samantaray et al. [34], where only FON pixels are used to estimate the original intensity value of the noisy pixel, as they are more correlated to the noisy pixel than the others. In the work by Samantaray et al. [34], as some pixels left with an extreme intensity value in case of all FON pixels have extreme intensity values, the process of restoration needed to be repeated to ensure that all noisy pixels have been restored. Some pixels have extreme intensity values that remain in the second round to be restored. In the second round, the FON pixels may already be restored depending on the second-order neighborhood (SON) and third-order neighborhood (TON) pixels. This means, in the second round, the process depends on SON and TON to estimate the original intensity value of the noisy pixel. Figure 2 shows the positions of FON, SON and TON pixels in relation to the noisy pixel P N (i.e., the pixel with N(x,y) = 1). These neighboring orders are based on the Euclidean distance between the noisy pixel and its neighboring pixels.
However, the SON pixels are more correlated to the central pixel than the TON pixels [22]. Based on that, an enhancement is proposed to the work by Samantaray et al. [34], where the SON pixels are used to estimate the original intensity value of the noisy pixels in the case of all the FON pixels having extreme intensity values. Thereafter, if all FON and SON pixels have extreme intensities, the pixel to be restored will either have an extreme intensity as the new intensity value or it should be left unchanged. The proposed method replaces the intensity value of the noisy pixel by the median value of the non-extreme intensity FON pixel intensities. The intensity value of the noisy pixel is replaced by the median value of the non-extreme intensity SON pixel intensities if all the FON pixels have extreme intensities. If all the FON and SON pixels have extreme intensities and the number of the opposite extreme intensity value pixels is bigger than 6, the new value of the corrupted pixel will be the opposite extreme intensity; otherwise, it will be left with no change.
To summarize, the steps are as follows: Step 1: Locate the noisy pixel PN (i.e., the pixel with N(x,y) = 1).
Step 2: Check the pixels surrounding PN in a window of size 3×3 with PN at the center of the window. If all pixels in the window have extreme intensities go to Step 4. Otherwise, go to Step 3.
Step 3: If all FON pixels have extreme intensities, the median value of SON pixels will be the new intensity value of PN. Otherwise, the median value of FON will be the new value of PN. Then go to Step 6.
Step 4: Count the number of the pixels having the opposite extreme intensity of PN, which is Co. Then go to Step 5.
Step 5: If Co greater than 6, the new value of PN will be the opposite extreme value of it. Otherwise, leave it with no change. Then move to Step 6.
Step 6: Repeat all steps for all noisy pixels in the image (i.e., the pixels with N(x,y) = 1).

Results and Discussions
To evaluate the results of the proposed noise detector and the mentioned detectors above, the missing detection rate (MDR), and the false detection rate (FDR) were used. Equations (3) and (4) show the mathematical expression for the MDR and the FDR, respectively [22].

( )
where f is the image matrix, Rr is the matrix for indicating noises added by Matlab 2018a, which indicates a noisy pixel with Rr(p) = 0, or noise-free with Rr(p) = 1; Rd is the matrix for indicating the detected noises, which indicates a noisy pixel with Rd(p) = 0, or noise-free with Rd(p) = 1; symbol ˄ refer to logical AND. MDR calculates the ratio of noisy pixels that the detector did not detect to the total number of noisy pixels in the corrupted image. Therefore, the lower the MDR ratio the better detecting capability. FDR calculates the ratio of noise-free pixels that the detector detects as noisy pixels to the The proposed method replaces the intensity value of the noisy pixel by the median value of the non-extreme intensity FON pixel intensities. The intensity value of the noisy pixel is replaced by the median value of the non-extreme intensity SON pixel intensities if all the FON pixels have extreme intensities. If all the FON and SON pixels have extreme intensities and the number of the opposite extreme intensity value pixels is bigger than 6, the new value of the corrupted pixel will be the opposite extreme intensity; otherwise, it will be left with no change.
To summarize, the steps are as follows: Step 1: Locate the noisy pixel P N (i.e., the pixel with N(x,y) = 1).
Step 2: Check the pixels surrounding P N in a window of size 3 × 3 with P N at the center of the window. If all pixels in the window have extreme intensities go to Step 4. Otherwise, go to Step 3.
Step 3: If all FON pixels have extreme intensities, the median value of SON pixels will be the new intensity value of P N . Otherwise, the median value of FON will be the new value of P N . Then go to Step 6.
Step 4: Count the number of the pixels having the opposite extreme intensity of P N , which is C o .
Then go to Step 5.
Step 5: If C o greater than 6, the new value of P N will be the opposite extreme value of it. Otherwise, leave it with no change. Then move to Step 6.
Step 6: Repeat all steps for all noisy pixels in the image (i.e., the pixels with N(x,y) = 1).

Results and Discussions
To evaluate the results of the proposed noise detector and the mentioned detectors above, the missing detection rate (MDR), and the false detection rate (FDR) were used. Equations (3) and (4) show the mathematical expression for the MDR and the FDR, respectively [22].
where f is the image matrix, R r is the matrix for indicating noises added by Matlab 2018a, which indicates a noisy pixel with R r (p) = 0, or noise-free with R r (p) = 1; R d is the matrix for indicating the detected noises, which indicates a noisy pixel with R d (p) = 0, or noise-free with R d (p) = 1; symbol ∧ refer to logical AND. MDR calculates the ratio of noisy pixels that the detector did not detect to the total number of noisy pixels in the corrupted image. Therefore, the lower the MDR ratio the better detecting capability. FDR calculates the ratio of noise-free pixels that the detector detects as noisy pixels to the total number of noisy pixels in the corrupted image. Therefore, the lower the FDR ratio, the better at not detecting false pixels.
However, to evaluate the image denoising stage of the proposed method and the methods mentioned above, the peak signal to noise ratio (PSNR) and structural similarity index (SSIM) are used. Equations (5) and (6) show the PSNR and SSIM mathematical expressions [22].
where, f is the original image and g is the restored image; m is the height of the image and n is the width of the image, σ f is the standard deviation of f and µ f is the mean value of f, σ g is the standard deviation of g and µ g is the mean value of g, σ fg is the covariance of f and g, C 1 and C 2 are the stabilizing constants, L is the number of intensities levels in the image, K 1 and K 2 are selected by default as 0.01 and 0.03, respectively. PSNR measures the resemblance between the original image and the restored image. Therefore, the higher the PSNR the better the restored image, which means the better the image denoiser restoring capability. SSIM measures the preservation capability of the structural information. Therefore, the higher the SSIM the better the preservation capability, which means better image denoiser structure information preservation capability.

Data Preparation
In this paper, 83 standard images will be used. These images are taken from the internet. All images are gray-scale images, with different size (i.e., 480 × 480 pixels, 512 × 512 pixels, 640 × 480 pixels, 720 × 576 pixels, and 720 × 580 pixels). These images have been selected because they are normally used in digital image processing research. Furthermore, most of them have large black or white regions on the image.
These images are divided into two groups. The first group consists of 33 images and is used as the training images T r . These images are used to determine the values of HDV and HMV. The remaining 50 images are used as the testing images T s . Because all images are considered noise-free images, to evaluate the performance of the methods in noise detection and image denoising, image T s will be synthetically corrupted by fixed value impulse noise using Matlab 2018a, from noise density 5% to 90%, with increment step of 5%. Therefore, 18 noise density levels are evaluated in this work.

Calculations to Determine HDV and HMV
To calculate the value of HDV, a procedure was conducted on the 33 original uncorrupted T r images. The procedure calculated the difference values between the NEI pixels and their surrounding pixels in a window of size 3 × 3 pixels. The results of this procedure are based on 59,122 NEI pixels found in the 33 T r images, which means 472,976 surrounding pixels. The results of the procedure are shown in Table 1. It can be analyzed from the results of Table 1 that NEI pixels are correlated to their surroundings. Of the surrounding pixels, 58.01% have the same intensity level as their NEI pixel and 14.7% have a difference in intensity level with their NEI between 1 to 10 intensity levels. However, it can be observed that the differences in intensity level ratio become less as the difference in intensity levels becomes higher.
The ratio of the difference value of less than 11 intensity levels between NEI pixels and their surrounding pixels in a window of size 3 × 3 pixels is equal to 72.7%. Therefore, the ratio of the difference value higher than 10 intensity levels between NEI pixels and their surrounding pixels in a window of size 3 × 3 pixels is equal to 27.3%. From this observation, the recommended HDV for the proposed method is 10 intensity levels.
To calculate the recommended value for HMV, another procedure has been conducted. The procedure was applied to these pixels surrounding NEI pixels in a window of size 3 × 3 pixels. As the recommended value for HDV is 10 intensity levels, the procedure was applied only on those pixels that had differences in intensity value from their NEI pixels that were less than 11 intensity levels.
The procedure to determine the value of HMV calculates the ratio of the mean values of the difference values between the intensity level of NEI pixels and their surrounding pixels within a window of size 3 × 3 pixels. The procedure was conducted on the same 33 images used to calculate the HDV value. Table 2 shows the results of the procedure. As shown in Table 2, it can be observed that most of the pixels surrounding the NEI pixels have a small difference in intensity level. The other differences may exist as they are on the border of an edge. The ratio for mean values less than three is equal to 95.5%. The ratio for mean values greater than three is increased slightly. Based on that, the recommended HMV value is 3.

Noise Detection Stage Evaluation
The proposed fixed value impulse noise detector and some of the recent detectors were applied to the 50 images from testing set T s , after adding noise to them. The detectors applied to images at each noise density from 5% to 90% with a gap difference of 5%. The MDR and FDR have been taken for each detector at each noise density. The average of MDR and FDR have been taken for all images at each noise density. Table 3 shows the results of the noise detection stage, where ND refers to noise density and AVG refers to the average. From Table 3, it can be observed that FTD has the best results for MDR, which means its miss-detection of noisy pixels is the lowest. Yet, FTD has the highest FDR, which means it detects noise-free pixels as noisy pixels more than the other methods.
The proposed method has the best result for FDR. This means that the proposed method has the lowest false noise detection ratio. Besides, the proposed method also performs well in terms of MDR, where the average MDR is still less than 1%. Furthermore, the proposed method also gives the lowest value when we add the average MDR with the average FDR, showing that the proposed method is the best noise detector amongst the evaluated methods in this work.

Image Denoising Stage Evaluation
To evaluate the noise cancelation stage, the proposed method and the recent methods we applied to the 50 T s images, after adding noise to them. The methods applied to images at each noise density from 5% to 90% with a gap difference of 5%. The PSNR and SSIM are used to evaluate each method at each noise density for all images. The average PSNR and the average SSIM have been taken for all images at each noise density for each method. The same fixed value impulse noise detector is used for methods. The detector used is FTD with threshold of 21. Table 4 shows the results of the experiment, where, ND refers to noise density and AVG refers to the average. It can be observed from Table 4, that the EDF method has the worst results in this experiment for both PSNR and SSIM. On the other hand, the proposed method has the best PSNR and SSIM results in the average of all densities in this experiment. This means that the proposed method has the best restoring and structure information preservation capability.

State-of-Art Evaluation
To evaluate the state-of-art of the proposed method, an experiment was conducted. The proposed method is evaluated by comparing it with some of the recent state-of-art methods. PSNR and SSIM will be used to evaluate the output images for each state-of-art at each noise density from 5% to 90% with 5% as a gap difference between those noise densities, using 50 T s images. Table 5 shows the average results for all images at each noise density, where, ND refers to noise density and AVG refers to the average. From Table 5, it can be observed that the state-of-art consists of EDF as a denoiser, and BDND as a noise detector has the worst results in both PSNR and SSIM. On the other hand, the state-of-art consists of the proposed detector, and the proposed denoiser has the best results in both PSNR and SSIM. This means, the proposed method is better than the other methods mentioned in this work.  show noisy images and their restored images. The noisy images are affected by fixed value impulse noise at 10%, 50% and 90% noise density, respectively. Each noisy image is restored by the proposed method and some of the recent methods. Figure 3 shows a noisy "Girl face" image by fixed value impulse noise at 10% density and its restored images by the proposed method and some of the recent methods that have been mentioned in this work. This figure presents the performance of the methods for a low corruption level. It can be observed that EDF+BDND has the worst restored image. On the other hand, the proposed method and the others have better results and they look similar. However, the PSNR of the proposed method is the highest.
Noisy "Girl" image at 50% noise density and its restored images are shown in Figure 4. This figure presents the performance of the methods for a medium corruption level. From the appearance of the restored images, it can be observed that EDF+BDND has the worst restored image. On the other hand, the other methods have a better appearance on their restored images, but the PSNR of the restored image by the proposed method is the highest. Figure 5. presents noisy "Tulips" image along with its restored images. In this figure, the noise density added is at 90%, to present a high corruption level. It can be observed from the appearance of the restored images that EDF+BDND has a less similar output image to the original image. On the other hand, the other methods have more similarity to the original image, but the restored image by the proposed method has the highest PSNR, which means that it has the most similarity to the original image.

Conclusions
In this paper, a method has been proposed to restore corrupted images by fixed value impulse noise. The proposed method has two stages, the noise detection stage and the image denoising stage. In the noise detection stage, the pixels with extreme intensities are denoted as noisy or noise-free pixels depending on the difference between their intensities and the intensities of the pixels surrounding them. An experiment was conducted to evaluate the proposed detector by comparing it with some of the recent detectors used to detect the fixed value impulse noise. The results of the experiment showed that the proposed detector has the best result in the average of all outputs.
In the image denoising stage, the noisy pixels are restored by estimating their original intensities based on the first-order and second-order neighborhood pixel intensities. An experiment has been conducted to evaluate the proposed image denoiser by comparing its output images with the output of some of the recent methods used to restore the images corrupted by fixed value impulse noise. The results of the experiments show that the proposed method has better restoring and structure information preservation capability. In future works, to further improve the method's performance, the authors will explore the possibilities of using inpainting approaches in the image-denoising stage. The inpainting methods have been used in noise reduction works, such as Zhou et al. [36] and Zhou et al. [37].

Conclusions
In this paper, a method has been proposed to restore corrupted images by fixed value impulse noise. The proposed method has two stages, the noise detection stage and the image denoising stage. In the noise detection stage, the pixels with extreme intensities are denoted as noisy or noise-free pixels depending on the difference between their intensities and the intensities of the pixels surrounding them. An experiment was conducted to evaluate the proposed detector by comparing it with some of the recent detectors used to detect the fixed value impulse noise. The results of the experiment showed that the proposed detector has the best result in the average of all outputs.
In the image denoising stage, the noisy pixels are restored by estimating their original intensities based on the first-order and second-order neighborhood pixel intensities. An experiment has been conducted to evaluate the proposed image denoiser by comparing its output images with the output of some of the recent methods used to restore the images corrupted by fixed value impulse noise. The results of the experiments show that the proposed method has better restoring and structure information preservation capability. In future works, to further improve the method's performance, the authors will explore the possibilities of using inpainting approaches in the image-denoising stage. The inpainting methods have been used in noise reduction works, such as Zhou et al. [36] and Zhou et al. [37].