A Novel Effective Edge-Based Image Denoising Algorithm

Department of Electronics and Communication Engineering, CVR College of Engineering, Hyderabad, India Department of Electronics and Computer Engineering, Sreenidhi Institute of Science and Technology, Hyderabad, India Department of Electronics and Communication Engineering, Kallam Haranathareddy Institute of Technology, Guntur, India Department of Electronics and Communication Engineering, Audisankara Institute of Technology, Gudur, India Department of Computer Science, Ambo University, Ambo, Ethiopia


Introduction
Noise is produced in the image during the process of acquisition or added to the image during the transmission of the image over the wired or wireless medium. Nowadays, wireless channels are preferred compared to the wired channels [1]. e wireless medium is more prone to noise, and this may lead to image degradation which a ects the image quality. ere is a wide variety of noise which a ects the quality of the image such as Gaussian noise, impulse noise, speckle noise, and random noise [2]. Impulse noise is also called as salt and pepper noise that arises due to the short presence of "on" and "o " of the pixel values due to surface degradation of the camera. e present article deals with the denoising salt and pepper noise from the noisy images. Unlike the other noise models, it does not add or multiply the original pixel values instead it replaces the pixel values either with 0 or 255 [3,4]. It appears in the image due to the malfunctioning of the devices which capture the images. e salt and pepper noise comes under high-frequency content in the image. However, the edges in the image also come under the high-frequency content of the image [5]. So, there is a challenge in distinguishing the salt and pepper noise from this edge. In the literature, few works exist to delineate the edge from noise [6].
In the medical eld, image denoising is very useful for accurate diagnosis, otherwise life may be destroyed. Traditional methods such as low-rank methods and sparse coding depend on the self-similarity of the image pixel values to denoise the noisy image [7]. e major problem with these traditional methods is that they remove or smooth the edge ( ne detail) information in the image. e edge details in the image are similar to the noise which is equivalent to the high frequency.
e rest of the article is organized as follows: Section 2 presents the proposed noise detection algorithm. Section 3 deals with the proposed denoising algorithm. e experimental results and comparisons with the existing methods in terms of metrics such as PSNR, SSIM, and IEF are elaborated in Section 4. Finally, the summary of the article is presented in Section 5.

Literature Review
e main aim of the image denoising is to minimize the amount of noise present in the image by retaining the original information in the image such as edges. e image denoising algorithms should not alter the edge information, texture information in the image should be preserved, and new artifacts should not be generated while denoising the image. e image denoising methods are broadly classified into two broad categories, namely spatial domain methods and transform domain methods. In the spatial domain method, the image is convolved with the low-pass filter mask/kernel for the removal of noise information from the image. e accuracy of the method depends on the weightage provided to the mask location in the image [8]. Spatial filtering is further divided into linear and nonlinear filters. Linear filters such as mean filter and Gaussian filter remove the noise content as well as the edge information from the image. ese filters are suitable for the removal of Gaussian noise in the image. e nonlinear filters such as the median filter, weighted median filter, and bilateral filter remove the noise from the edge by retaining the edge information. ese filters are useful in the removal of salt and pepper noise from the images. In general, the spatial filter removes the noise from the images at the expense of losing the edge information from the image [9].
Median filter is a nonlinear filter which is specifically designed for the removal of the salt and pepper noise from the image. e masks used in median filter are usually odd in size such as 3 × 3, 5 × 5, etc. e values within the mask are sorted, and the processing element is replaced with the middle values of the sorted element array. e computational complexity of the median filter is very low. But it fails to denoise the images, when the size of the image is small, or the variance of the noise level increases. e lower size of the mask is effective when the noise level in the image is low; and for the higher level of noise variance, the higher size mask is preferred. e adaptive median filter adjusts the size of the mask based on the level of noise variance [10].
Also, a wide variety of nonlinear spatial filters have been proposed to restore the original image, which is corrupted with noise. Among the various techniques, median filter (MF) has been widely used in the literature for the removal of salt and pepper noise. But the use of MF was effective when the noise density is very low, and it failed to recover the original image when the noise density is high [11]. ere exists a relationship between the noise density and the size of the mask, which says that the size of the mask should be the minimum for a low noise density and vice versa. To improve the quality of the restored image in terms of PSNR, the size of the mask should be increased with the increase in noise density. Based on MF theory, adaptive median filter (AMF) was proposed by adjusting the size of the window based on noise variance (σ^2) in the image. However, the major drawback of the AMF is that it fails to preserve the edge information for a high noise density model [12]. Inspired by the AMF works, switching median filter (SMF) was proposed by adjusting the size of the mask with respect to the local threshold value. However, the value of the threshold varies dynamically, and it also depends on the number of noise pixels present in the vicinity of the current processing pixel [13]. e aforementioned filter-based method does not consider the local features; as a result, the edge information is not retained properly.
To deal with the edge information, a decision-based algorithm (DBA) with a 3 × 3 mask was proposed. is method simply replaces the noisy pixels based on the threshold value alone, which results in a streaking effect in the restored image [14]. To resolve the streaking effect, decision-based unsymmetric trimmed median filter (DBUTMF) was proposed. However, the method fails to denoise the image for a high value of noise variance (more than, 50%) [15]. A noise adaptive fuzzy switching median (NAFSM) algorithm was proposed. is method uses two stages to retrieve the original image from the noisy image [16]. In the first phase, the corrupted pixels of the noisy image are identified with the histogram. In the second phase, a suitable membership function is designed to filter these noisy pixels, and the value is modified based on the neighbourhood of the processing pixels [17]. Even though the technique is efficient, it has high time complexity. e other proposed method is the interquartile range (IQR) filter [18]. It is a nonlinear spatial filter that aims at removing the noise by preserving the edge information. e IQR process simply replaces the processing pixel with the mean of the surrounding non-noisy pixels [19]. All these methods are again valid for low-range noise variance image but not for high noise level. To tackle mild or high noise levels, adaptive IQR (AIQR) [20] filter was proposed; this varies the size of the mask with the noise density. It provides higher PSNR compared to the other methods, but it fails to preserve the edge information. e transform domain methods transform the image from spatial domain to the frequency domain, and a suitable filter was applied to remove the noise and it is transformed to the spatial domain for a better visualization of the image [21]. But the frequency domain methods consume more processing time during conversion from the spatial domain to the frequency domain and vice versa [22]. e transform adaptive filtering is further classified into two categories, namely data adaptive and non-data adaptive [23].
In the data adaptive transform methods, principal component analysis (PCA) and independent component analysis (ICA) are employed as transform tools for the conversion process [24]. ese methods assume that the noise is a high-frequency component and is present in the last band of the image frame. Among these two methods, ICA proves to be effective in the removal of the Gaussian noise from the images. But these methods suffer from the huge computational cost since it employs the sliding window algorithm [22]. ese methods prove to be effective for the denoising of satellite images. e non-data adaptive transform methods are classified into wavelet domain-based methods and spatial domainbased methods.
e wavelet-based non-data adaptive 2 Scientific Programming method decomposes the original image into sub-bands. ese methods have been proved that it can remove the noise from the image and preserve the characteristics of the image. e performance of these wavelet methods relies on the selection of the basis function used in the denoising process. ere are numerous basis functions available in the wavelet transform, and each basis function is designed for a specific application. Improper selection of the basis function leads to poor denoising performance [23].
Block-matching three-dimensional (BM3D) is a transform method which employs the 2-stage nonlocal collaborative filtering operation. e similar patches in the original image are stacked into 3-dimensional groups, and these groups are transformed using the wavelet domain methods.
en it is subjected to denoising by using the hardthresholding algorithm [24]. By using inverse wavelet transforms and aligning the patches correctly, the denoised image is reconstructed [25]. is method proves to be effective when the noise variance is low and the performance degrades as the noise level in the image increases and hence artifacts are introduced into the denoised image [26].
e gradient-based image model uses the heavy-tailed distribution of the image gradient compared to the traditional-based models because they use the statistical model to predict the gradients of the image [27]. e gradient-based model suffers from the huge computational cost which incurs due to the estimation of the statistical parameters of the image dynamically during the runtime [28]. e deep learning methods achieve better accuracy compared to the statistical models and gradient-based models [29]. e deep learning models suffer from the problem that it requires a huge database for training and testing to improve the accuracy of the model [30]. One more problem with the deep learning models is the number of layers needed to denoise the image and the type of model required for denoising [31].
Bnou et al. proposed a machine learning-based model for image denoising. ey used an unsupervised learning model in their work and proved that it presents better performance compared to the supervised learning model of image denoising [32]. ey have modified the algorithm based on the dictionary-based model to improve the quality of performance [33]. e quality of the performance depends on the training samples [34]. When the number of images used for training increases, performance improves, but too much training degrades performance [35].
Patanavijit et al. proposed in his work a novel method for denoising the random-valued impulse noise. In the present work, the author has overcome the limitation of the adaptive median filter by a novel filter under both unsystematic intensity impulse and salt [36] and pepper noise [37].
Yan xing et al. proposed in their work about the usage of deep learning methods for the removal of salt and pepper noise from the images. A multilayer convolution neural network had been used in their work which consists of a convolution layer for extracting the useful features from the image, a max pooling layer for reducing the dimensionality of the image, and the activation function. But the proposed method requires a huge dataset for training and testing purposes [38]. e accuracy of the method depends on the training. Another drawback of this model is that every image has to be resized to fixed dimension of 224 × 224 or 124 × 124. e method requires a huge amount of time for training purpose also [39].
Limshuebchuey and Saejia compared various deep learning algorithms for the removal of noise from the images. ey have compared the traditional methods with the deep learning models in terms of PSNR and SSIM. Deep learning clearly shows an upper hand compared to the traditional methods. But the major problem with the deep learning models is the time required for training and number of images required for training. e architecture of the model varies as the noise variance varies in the image. Gaussian noise and impulse noise had been used in their work for denoising [40].
Singh et al. used the autoencoder model for the image denoising. In this work, the authors used the deep convolutional neural network-based model VGG16 with the custom dataset of bad weather outdoor images via transfer learning. e sequential model 1 and model 2 are evaluated to have a smooth image. e model architecture using DCNN is designed, and training of the model is obtained using transfer learning. A model using an autoencoder is designed. To decrease training time and perform better, RELU is used. In CNN, the number of epochs with increased performance was identified. e author had never mentioned in his work the advantage of the VGG16 model in the work. However, the performance of the model depends on the transfer learning model used in the work [41].
Wang et al. used an unsupervised learning model for denoising the image. ey have designed a network based on the modified iterative soft threshold algorithm (ISTA), which omitted the soft threshold to alleviate uncertainties introduced by empirically selected thresholds. In this network, we set the dictionary and code as trainable parameters. A loss function with a smooth penalty was designed to ensure that the network training can be implemented in an unsupervised manner. ey fused the result obtained from the block matching 3D algorithm and the unsupervised model, which improves the result further [42].
is article proposes an edge-preserving denoising algorithm, which can discriminate the noisy pixels from the edge pixels. So, the final retrieved image would be clear from the salt and pepper noise and it preserves the edge information. Since this method uses a two-level adaptive filter to retrieve the values based on the direction of the edge, it is efficient and has less time complexity. e proposed algorithm was tested on both the grey as well as colour images and it has shown a good PSNR, SSIM, and IEF over the exiting methods.

Proposed Method
is study aims at the minimization of the impact of impulse noise and had not considered any other type of noise. e masks designed in this work were based on the statistical properties of the impulse noise. In general, denoising methods are suffered with the similarity between an edge and noise whose intensity value is always high. Because of Scientific Programming this, edges are not perfectly discriminated from noise. is we achieved with the help of directional filters. Image denoising can be done either in the spatial domain or in the frequency domain. Frequency domain filtering needs the image to be transformed into the frequency domain from the spatial domain, then the suitable filter has to be applied for the removal of noise and then it has to be converted back into the spatial domain for the visualization purpose. Hence it requires a lot of computation for the process of denoising. In this study, spatial domain filtering is used since the computation time of the spatial domain filtering is less than that compared to the frequency domain filtering. e proposed method works only for the minimization of the impact of salt and pepper noise in the images [32]. e masks used in this study are specifically designed for the removal of salt and pepper noise by preserving the edges as discussed in the following section and are shown in Figure 1. e proposed algorithm is organized into three stages. e first stage is to identify the noisy pixels based on the pixel values. While in the second stage, a combination of noisy and non-noisy pixel is approximated with a surrounding mean filter. Here, the size of the mask depends on the number of noisy pixels present in the neighbourhood of the current processing pixel. In the final stage, a special mask of fixed size 3 × 3 is applied to the processed noisy pixel in the direction of the noisy pixel(s); at this stage, edge and noisy pixels are distinguished.
In the first stage, a pixel is considered as noisy based on the threshold value, that is either minimum or maximum grey level value that is 0 or 255. is can be suggestible, because of the nature of salt and pepper noise. But all such values might not be considered as noise, some of the pixels are part of the image. In the second stage, adaptive IQR algorithm is utilized for denoising. is adaptive IQR algorithm works better than the existing median-based filters because of quartile values with soft thresholding.
is improves the performance of the denoising algorithm in various situations like high contrast and low contrast images. In the adaptive IQR filter, the initial size of the mask used is 3 × 3. If the number of uncorrupted pixels in the mask is less than the order of the mask, then the size of the mask is increased to a next higher order, that is 5,7,9 etc.
In the third stage, the Sobel operator is used to find the direction of an edge at each one of the noisy processed pixels. e processed noise pixel values are modified based on the direction of the edge information. e grey levels of the corrupted pixel values are updated based on the direction of the edges in the image of that window. Sobel operator consists of a pair of 3 × 3 convolution masks to obtain the spatial gradient of the image. ese kernels are used to obtain the magnitude of the gradient component in the horizontal and vertical directions. e proposed edge denoising algorithm flowchart is shown in Figure 2.
is proposed algorithm is for greyscale images. To validate it for the colour images, repeat the steps from 2 to 6 on each one of the individually extracted R, G, and B channels. e edge orientation angle can be determined with the help of spatial gradient and is given below:

Algorithm.
Step 1: Add the salt and pepper noise of known variance (5,10, . . ., 90) and zero-mean to the original image.
Step 2: Discriminate the noisy pixels from the nonnoisy pixels in the image by using the hard-thresholding technique.
Step 3: As a preliminary process, denoise the image by applying the IQR algorithm.
Step 4: Delineate edge and noise using the spatial directional filters.
Step 5: Apply the edge-based mask for denoising the image.
Step 6: Evaluate the performance metrics such as PSNR, SSIM, and IEF for the denoised image with the original version.  Scientific Programming edges in the image. e strength of the edge and the direction of the edge information can obtained using these gradients. Figure 1 shows that the range of direction of the edge in an image considered in this work is from 0°to 180°. is entire range is divided into 8 possible orientations (in degrees) such as 0, 22.5, 45, 67.5, 90, 112.5, 135, and 157.5. e 3 × 3 kernels are developed for each orientation and are represented in Figure 1(a)-1(l).

Results and Discussion
For this study, the image is subjected to a known amount of noise variance ranging from 5% to 90%. To demonstrate the efficacy of the proposed edge-based denoising (EBD) technique, the performance was compared with the existing denoising techniques such as median filter (MF), adaptive median filter (AMF), interquartile range filter (IQR), adaptive IQR (AIQR), based on pixel density filter (BPDF), and noise adaptive fuzzy switching median filter (NAFSM). e results are valid for both the greyscale and colour images. e performance metrics used for this study are PSNR, SSIM, and IEF. Mean squared error is defined as the cumulative of the squared error between the original image and the denoised output image and is shown in equation (2). e PSNR is commonly used as measure of quality reconstruction of image. It indicates the peak error in the image and is shown in (3). Structural similarity index is used to calculate the similarity between the images. is referential metrics considers image degradation which perceived changes in the form of structural information of the interdependence points and is shown in equation (4). μ defines the mean value of the image and σ defines the variance of the image. Image enhancement factor validates the enhanced factor of the images by comparing each and every pixel points which are modified after denoising [8]. It is calculated by taking the ratio between the sum of square of difference of original with the noise image and the sum of square of difference of denoised image with the noisy image and is shown in equation (5).
e qualitative analysis of comparison of the proposed method with other standard methods subjected to a noise variances of 30% and 70%, respectively, is shown in Figures 4  and 5 for the Lena image (greyscale). It is found that the performance metrics of the proposed method surpasses the other methods as the noise density increases. e quantitative analyses of all these results are tabulated in Tables 1-3. It has been observed that the proposed method outperforms when the noise density is greater than 10%. However, it is found that the proposed method shows a slightly less performance than the BPDF method when the noise variance is 5%.
As shown in Table 1, the PSNR metric obtained from various denoising techniques clearly reveals that EBM techniques outperforms the other techniques for various noise levels ranging from 5% to 90%. Similarly, the other metrics like SSIM and IEF are also inferred from Tables 2 and 3, respectively. Figure 6 represents the comparison of PSNR metric on colour Lena image. It is observed that the proposed denoising technique produces a high-quality image even when the noise levels are high. Similar tabular representations are shown in Tables 4-6. In order to get a crisp overview, the pixel-level comparison is shown in Figure 7. Figure 6 shows the graphical representation of the PSNR metric obtained from various denoising techniques on greyscale Lena image. From Figure 6, it is clear that EBM techniques outperforms the other techniques for various noise levels ranging from 5% to 90%. Similarly, the other metrics like SSIM and IEF are also shown in Figures 7 and 8, respectively.            (f ) (g) (h) Figure 9: Various method results with 30% noise density: (a) Image with noise density of 30%; (b) MF [8]; (c) AMF [9]; (d) IQR [15]; (e) AIQR [16]; (f ) BPDF [18]; (g) NAFSM [13]; and (h) EBD. Now the same procedure was applied on colour images. e qualitative [visual] comparison results of the proposed method with the other standard methods are shown in Figure 9 for the Lena colour image with noise variances of 30% and 70%, respectively. e only difference between the greyscale and colour image is that colour image is processed with individual R, B, and G channels. e quantitative [tabular] analysis of the comparison is tabulated in Table 4 [PSNR], Table 5[SSIM], and Table 6 [IEF], respectively. It is observed that the proposed EBD method outperforms when the noise density is greater than 10%. e results of the proposed method are slightly less than the BPDF method when the noise variance is less than 5%. Figure 10 represents the comparison of PSNR metric on colour Lena image [29]. It is observed that the proposed denoising technique produces a high-quality image even when the noise levels are high. Similar graphical representations are shown in Figures 11 and 12 for the performance metric SSIM and IEF. Figure 13 depicts a crisp overview of various denoising techniques applied on the Lena image.

Conclusion
e proposed edge-based denoising method successfully discriminates edges while approximating the salt and pepper noises in the images. By considering the edge details with specific Sobel filters, the statistical quality also improved a lot. e performance of the algorithm was tested for different noise densities ranging from 5% to 90% on greyscale as well as on the colour images. e proposed EBD denoising technique has shown promising results when compared with the existing methods even for high noise levels. is was proved with the help of various noise metrics such as PSNR, SSIM, and IEF. It is concluded that the proposed algorithm is proved as an effective technique for the removal of salt and pepper noise in the grey as well as in the colour images, and also it is proved that it is computationally efficient method in identifying the edge from noise.

Data Availability
e data used to support the findings of this study are included within the article and further data or information can be obtained from the corresponding author upon request.