Skip to main content

An adaptive switching filter based on approximated variance for detection of impulse noise from color images

Abstract

A new adaptive switching algorithm is presented where two adaptive filters are switched correspondingly for lower and higher noise ratio of the image. An adaptive center weighted vector median filter is used for the lower noise ratio whereas for higher noise ratio the noisy pixels are detected based on the comparison of the difference between the mean of the vector pixels in the window and the approximated variance of the vector pixels in the window. Then the window comprising the detected noisy pixel is further considered where the pixels are given exponential weights according to their similarity to the other neighboring pixels, spatially and radio metrically. The noisy pixels are then replaced by the weighted average of the pixels within the window. The filter is able to preserve higher signal content in the higher noise ratio as compared to other robust filters in comparison. With a little high in computational complexity, this technique performs well both in lower and higher noise ratios. Simulation results on various RGB images show that the proposed algorithm outperforms many other existing nonlinear filters in terms of preservation of edges and fine details.

Background

Filtering is one of the most essential steps in the applications of image processing. An image must contain the required data to show the correct information before it is used for any image processing application. But images are usually corrupted with unwanted information that causes hindrance to an efficient image processing operations. These unwanted information which are termed as noise must be removed properly from the image as a preprocessing step. Additive random noise (Gaussian noise) and salt and pepper noise are some of the most common noises found in digital image. Impulse noise which may be fixed valued noise (FVN) or random valued noise (RVN) is one of the most naturally occurring noises in digital images and it is induced in the image during image acquisition by faulty sensors or during transmission through communication channels. Noise removal techniques depends on the type of noises degrading the image and also largely on the percentage of noise corrupting the image. A number of robust filters have been proposed in literature for filtering the color images corrupted with impulse noise. Non-linear filters which actually work in spatial domain suit well for impulse noise removal from color images (Celebi et al. 2007).

Initial approach like the marginal median filter (MMF) treats the color image channel wise in a scalar form which often leads to color artifacts (Pitas 1990). The nonlinear filters like the vector median filter (VMF) (Astola et al. 1990) and the basic vector directional filter (BVDF) (Trahanias and Venetsanopoulos 1992) which consider the color pixels as vectors and work on the concept of order-static filters, are very efficient for the impulse noise removal of color images. The VMF forms a sorted array of the cumulative distance of intensity value of the vector pixels from the surrounding pixels in the window, and then the corresponding vector pixel which gives the least value of cumulative distance in the sorted array is substituted as the vector median instead of the center pixel. And in case of VDF, the sorted array is of the cumulative angular distance of the vector pixels from the surrounding vectors in the window. Thus the output of the VDF is the vector pixel that corresponds to the least value of cumulative angular distance. The directional-distance filter (DDF) (Karakos and Trahanias 1995) combines the μ magnitude part from the VMF and the (1 − μ) angular part from the VDF in calculating the cumulative distances from a vector pixel to the other in the filtering window. The center weighted VMF (CWVMF) (Smolka et al. 2012a), center weighted VDF (CWVDF) and the center weighted DDF (CWDDF) highlight the center pixel by assigning more weight. These filters have a tendency to preserve the center pixel in the filtering window which reduces the efficiency in higher noise ratio. These are the popular filters where the filtering is done uniformly across the pixels without using an actual noise detection algorithm. These filters tend to modify the uncorrupted pixels which result in blurring of the edges and loss of fine details of the image.

To overcome this particular issue noise detection schemes are introduced in the rank order static filters (Lukac 2004, Lukar and Smolka 2003), that check whether the center pixel is noisy or not. Then the noisy pixel is replaced by the output of a vector filter otherwise it is left unaltered. The adaptive CWVMF (ACWVMF) (Lukac and Smolka 2003), adaptive CWVDF (ACWVDF) (Lukac 2004) and adaptive CWDDF (ACWDDF) replace the center pixel by the output of VMF, VDF and DDF respectively, if the difference between the center pixel and the corresponding center-weighted vector median is greater than a user specified threshold. A weight in the range of 0–1 is given to cumulative distance of the center pixel, for getting the vector median of the modified CWVMF (MCWVMF).

In the peer group filter (PGF) the pixels in the window is sorted according to their differences from the center pixel, then a peer group of \( m = {{\left( {\sqrt n + 1} \right)} \mathord{\left/ {\vphantom {{\left( {\sqrt n + 1} \right)} 2}} \right. \kern-0pt} 2} \) is selected from the sorted array, where n is the number of vector pixels in the window. If the difference between any two pixels from the peer group is greater than user-specified threshold, then the center pixel is replaced with the output of VMF. And if the difference of the individual pixel, in the peer group m, from the center pixel is less than a user specified threshold, then the center pixel is replaced with the VMF, which results in the fast PGF (FPGF) (Kenny et al. 2001; Smolka and Chydzinski 2005; Malinski and Smolka 2015). The adaptive VMF (AVMF) and adaptive VDF (AVDF) replace the center pixel with the output of VMF and VDF respectively if their respective cumulative distance is greater than a user specified threshold \( \partial \) and T (Lukac 2002, 2003).

The entropy VMF (EVMF), entropy VDF (EVDF) and entropy DDF (EDDF) are the group of entropy vector filters which replace the center pixel with the output of VMF, VDF and DDF respectively, if the local contrast entropy of the center pixel is greater than its local contrast entropic threshold multiplied by a weighting factor υ (Lukac et al. 2003).

The Neuvo VMF (NVMF) (Sun and Neuvo 1994) is that kind of vector filter where the center pixel is considered to be noisy if its difference from the vector median is bigger than a predefined threshold. For the rank-conditioned VMF (RCVMF), rank-conditioned VDF (RCVDF) and rank-conditioned DDF (RCDDF), with respect to ascending order of the respective cumulative distances, a subset of the vector pixels excluding the minimum and maximum values is formed (Singh and Bora 2004). If the center pixel is not in the ordered subset, then it is replaced by the output of VMF, VDF and DDF respectively. If l is the number of pixels in the ordered set, then position of the noisy center pixel will be outside the range of l. In the rank-conditioned and threshold VMF (RCTVMF), rank-conditioned and threshold VDF (RCTVDF) and rank-conditioned and threshold DDF (RCTDDF) (Singh and Bora 2004; Smolka et al. 2012b), the center pixel is considered as noisy if it does not belong in the trimmed set and its difference from the respective vector median is greater than a pre-defined threshold.

The group of fuzzy weighted filters namely the fuzzy vector median filter (FVMF), fuzzy vector directional filter (FVDF) and fuzzy directional distance filter (FDDF) weight the pixels in the filtering window according to their respective cumulative distance before replacing the center pixel with the average of the weighted pixels. These filters use certain parameters α and β to adjust amount of fuzziness in weighting the pixels (Plataniostis et al. 1996, 1999). The fuzzy ordered vector filter (FOVMF) picks up the first l elements of the ordered set of cumulative distances, and then assigns the weight only to the corresponding pixels.

In the signal dependent rank-ordered mean (SDM), if the difference between the center pixel and the first four pixels of the rank-ordered set of pixels is greater than four separate thresholds T a , T b , T c and T d respectively, Moore et al. (1999) then the center pixel is replaced with the output of VMF. The robust switching vector median filter (RSVMF) proposed by Celebi and Aslandogan considers the noisy pixel to be a noisy pixel if the cumulative distance with respect to the center pixel is greater than a predefined percentage β of the cumulative distance associated with the median (Celebi and Aslandogan 2008).

The non-causal linear predictor based filters use the concept of linear prediction (Singh 2012; Singh and Bora 2003) for estimating the center pixel as a weighted combination of past and future vector pixels with respect to the center pixel. It is based on the fact that there exists a strong correlation among the neighborhood pixels of a window centered at a vector pixel.

The non-causal vector median filter (NCVMF) (Singh and Bora 2014) first filters the image using VMF, then estimates the center pixel using constrained intra-channel linear predictor (Hu et al. 1997) by considering the eight second order pixels (see Fig. 1) (David and Ramamurthi 1991; Asif and Moura 1996; Asif 2004). Then if the difference between the predicted pixel and the center pixel is greater than or equal to a user-specified threshold, the center pixel is replaced by the output of VMF, VDF or DDF. In the rank conditioned non-causal vector median filter (NCRVMF), the value of index p, which corresponds to the least valued element from the sorted array of cumulative distance of the vector pixels in the window, is compared with a threshold, which is calculated based on the standard deviations of the separate three channels of the image. If the value of k is greater than that of the threshold T, then the center pixel is predicted considering the 2nd order non-causal regions. The non causal vector median filter 2nd order non causal (NCVMF_2nc) considers only the upper four non causal pixels out of the eight, from the 2nd order region excluding the center pixel. The non causal vector median filter 1st order non causal (NCVMF_1nc) considers the four 1st order pixels from the non causal region. The non causal vector median filter 1st order causal (NCVMF_1c) predicts the center pixel using the two pixels of the 1st order causal region.

Fig. 1
figure 1

Block of causal and non causal regions showing different orders

The adaptive vector marginal median filter (AVMMF) compares the cumulative distance of the center pixel with that of the sorted array of the cumulative distance of all the pixels in the window, so that center pixel lies in the l index in the sorted array (Morillas et al. 2011). And if l is greater than the index defining the center of the window, then the center pixel is replaced by the median of the vector medians for n = 1, 2, …, k, where n is the index of the sorted array of cumulative distances of the pixels in the window.

The vector sigma filters (Lukac et al. 2006) which are based on approximated variance of the vector pixels in the window are grouped into adaptive and non-adaptive. The multivariate variance is calculated either based on the vector mean or the lowest ranked vector, vector median. In the non-adaptive group of vector sigma filters the center pixel is replaced with the output of VMF, VDF and DDF, if the cumulative distance of the center pixel is greater than a threshold, calculated based on the cumulative distance of the mean vector or the vector median and a parameter μ. This results to the corresponding non-adaptive sigma vector filters as SVMF_MEAN, SVMF_RANK, SVDF_MEAN, SVDF_RANK, SDDF_MEAN and SDDF_RANK respectively. Then the groups of adaptive sigma vector filters are ASVMF_MEAN, ASVMF_RANK, ASVDF_MEAN, ASVDF_RANK, SDDF_MEAN and ASDDF_RANK correspondingly. Here the center pixel is replaced with output of VMF, VDF and DDF respectively if the difference between the center pixel and the mean vector or the vector median is greater than the product of the corresponding approximated variance and a weighting parameter μ, where the approximated variance is calculated based on the cumulative distance of the vector pixels in the window from that of the mean vector.

Many robust filters for impulse noise removal have been proposed in the literature but most of them which work efficiently in the lower noise ratio, lack considerably in the higher noise ratio. Filters like CWVMF, CWVDF, CWDDF, RCTVDF, RCTVDF, RCTDDF etc. which perform very well in the lowest noise ratio group, are not efficient in the higher noise ratio group. On the other hand filters like ASVMF_MEAN, ASDDF_MEAN and EVMF work quite well both in lowest and highest noise ratio group.

In this work, a simple algorithm checks the impulse noise ratio in the image prior to the implementation of the noise detection algorithms, depending on which two filters are switched accordingly from lower noise ratio to higher and vice versa. In the higher nose ratio, the noisy pixels are identified with the help of noise detection algorithm, based on how much the center pixel is different from the mean vector of the neighboring vectors in the widow (Lukac et al. 2006). Then the detected noisy pixels are replaced with the output of modified exponentially weighted mean filter (Celebi et al. 2007) based on the concept of bilateral filter (Tomashi and Manduchi 1998; Daniel John 2013; Kaur et al. 2015), whereas the uncorrupted pixels are kept untouched.

Proposed method” section describes the proposed method. Noise model performance measuring parameters are described briefly in the next “Filter evaluation” section and finally the details are summarized and concluded in “Conclusions” section.

Proposed method

Let a color image X of size P × Q be represented by a 2-D array of 3 component vectors represented as,

$$ \varvec{x}(p,q) = \left[ {x^{R} (p,q),x^{G} (p,q),x^{B} (p,q)} \right]\, $$
(1)

where \( p = 1,2,3 \ldots P \) and \( q = 1,2,3 \ldots Q \) represents the row and column indices. R, G and B represent the Red, Green and Blue components of the vector pixel x(p,q). As usual in the basic filtering approach, a window W of odd size m × n centered at x(p,q) is considered (see Fig. 2). Considering the fact that impulse noise is distributed randomly which results in the variation of noise content in different parts of the image, before checking whether the center pixel is noisy or not, a localized impulse noise probability P r , in the window comprising the center pixel is calculated as,

$$ p_{r} = N_{imp} /{m \times n}$$
(2)

where N imp is the number of 0 s and 255 s in the window. If \( T_{L} \le p_{r} \le \,T_{H} \), then the center pixel is replaced with the output of the ACWVMF, otherwise it is replaced with the output of the modified ASVMF_MEAN, MASVMF_MEAN, to give the overall proposed noise percentage based switching filter, NPSF as shown below

$$ \varvec{x}_{NPSF} = \,\,\left\{ \begin{array}{ll} \varvec{x}_{ACWVMF} &\quad if\,\,T_{L} \le p_{r} \le T_{H} \hfill \\ \varvec{x}_{MASVMF\_MEAN} &\quad otherwise \, \hfill \\ \end{array} \right. $$
(3)

T L and T H are the lower and higher threshold value of p r . x NPSF is the output of NPSF and x ACWMF is the output of ACWVMF which is defined as

$$ \varvec{x}_{ACWVMF} = \left\{ \begin{array}{ll} \varvec{x}_{VMF}&\quad if\,\,\sum\nolimits_{u = \nu }^{\nu + 2} {\left\| {\varvec{x}_{{CWVMF^{u} }} - \varvec{x}(p,q)} \right\| > \,T,} \hfill \\ \varvec{x}(p,q)&\quad otherwise \hfill \\ \end{array} \right.\quad \nu \in \,[1,\,c - 1]\, $$
(4)

where \( c = {{((m \times n) + 1)} \mathord{\left/ {\vphantom {{((m \times n) + 1)} 2}} \right. \kern-0pt} 2} \), T is the threshold, with which the difference of the center pixel from the output of CWVMF is compared with and x CWVMF is the output of CWVMF which is given as

$$ \varvec{x}_{{CWVMF^{u} }} = \,\arg \min_{{x_{i} \in \,W}} \,\left( {\sum\limits_{j = 1}^{m \times n} {w_{j} } (u).\,\left\| {\varvec{x}_{i} - \varvec{x}_{j} } \right\|} \right) $$

and

$$ w_{j} (u) = \left\{ {\begin{array}{*{20}l} {m \times n - 2u + 2} \hfill &\quad {for\,\,j = \,c} \hfill \\ 1 \hfill &\quad {otherwise} \hfill \\ \end{array} } \right.,\quad \,u \in \,[1,\,c]\, $$
(5)

represents the weight to be given to the center pixel.

Fig. 2
figure 2

A 3 × 3 window of color vectors with their coordinates

ACWVMF is chosen for the window with less number of impulse noises, like if at the most one number of 0 or 255 is present. It is a very robust filter which is very efficient and flexible in removing impulse noise, which actually allows one to design an optimal filter for a particular domain by adjusting the weights assigned to the center pixel. The weights are estimated using an optimization procedure in Eq. 5 by using a number of training images (Celebi et al. 2007). u is used as the smoothing parameter such that if u = 1 the ACWVMF becomes an identity filter and so no smoothing will be performed and if the value of u increases from 1 to 5, the smoothing potential of the filter increases. When u reaches the value of c, lastly the ACWVMF becomes the VMF where the maximum amount of smoothing is done. In this paper three values of u is chosen from v to v + 2, for which three respective CWVMF outputs are determined to be subtracted from their respective center pixel as seen in Eq. 4. And if the sum of the three differences is greater than the threshold T then the center pixel is replaced with the output of VMF. In the ACWVMF the center pixel is highlighted or given more importance without a prior knowledge of whether it is a noisy pixel or not, by assigning a variable weight by Eq. 5, that makes the ACWVMF more suitable to be considered for windows which contain at the most one 0 or 255. The ACWVMF has a tendency to preserve the center pixel that makes it more suitable for lower noised region of the image.

And for the window with two or more number of 0 s and 255 s, a detection algorithm based on ASVMF_MEAN is used where the noisy pixel is detected based on the comparison of the center pixel with that of an approximated variance of the vector pixels in the filtering window (see Fig. 3). Depending on the fact that the impulse noise usually has very high or very low pixel value as compared to the surrounding pixels, the variance is calculated based on the mean vector of the pixels in the window, where mean is considered as one of the most probable values other than the vector median, for substituting the noisy pixel. Once the noisy pixels are detected, they will be replaced by the output of an exponentially weighted filter. The complete algorithm of noise detection using the approximated variance and replacement of the center pixel by the output of the exponentially weighted filter, defines the MASVMF_MEAN.

Fig. 3
figure 3

Flowchart of the proposed algorithm

The variance σ 2, which is to be compared with, is calculated as,

$$ \sigma^{2} = \frac{1}{m \times n}\sum\limits_{i = 1}^{m \times n} {\left\| {x_{i} - \,x_{mean} } \right\|}^{2} $$
(6)

where,

$$ \,\left\| {\varvec{x}_{i} - x_{mean} \,} \right\|^{2} = \,\,\left| {\varvec{x}_{i}^{R} - x_{mean}^{R} } \right|^{2} + \left| {\varvec{x}_{i}^{G} - x_{mean}^{G} } \right|^{2} + \left| {\varvec{x}_{i}^{B} - x_{mean}^{B} } \right|^{2} $$
(7)

x mean is the mean of the vector pixels in the window W. For checking the pixels to be noisy or not, the difference of the center pixel, x(p,q) from the mean, x mean is compared with the approximated variance, σ 2 multiplied by a weighting factor \( \partial \), to give \( \partial \times \sigma^{\,2} \) and if \( \left\| {x(p,q) - x_{mean} } \right\| \ge \partial \times \sigma^{\,2} \), then the centered pixel x(p,q) is considered to be a noisy pixel.

This particular detection algorithm based on ASVMF_MEAN is suitable for higher noise region of the image because the approximated variance is calculated based on the cumulative difference of the vector pixels from the mean, which means that all the pixels whether impulse noise or not are considered and are given similar importance. And the vector pixel is treated as impulse noise if it is having a bigger difference from the mean, as compared to average of the difference of vector pixels from the mean as seen in Eqs. 6 and 7. Then the window where the center pixel is detected as noisy pixel is further considered for further classification of the vector pixels among themselves with respect to their individual importance in the window. This further classification is helpful for window with more number of impulse noises where more number of 0 s and 255 s are present as it helps in more efficient detection of noisy pixel. The classification and the corresponding assignment of weights to the respective vector pixel according to their importance in the window is given by the equation

$$ w_{i} = e^{{ - \,\,\left( {\frac{{d(i)^{\alpha } + l(i)^{\eta } }}{\beta }} \right)}} \quad for\,\,i = \,1,2,3, \ldots ,\,m \times \,n\, $$
(8)

where

$$ d(i) = \sum\limits_{j = 1}^{m \times n} {s\left( {\varvec{x}_{i} ,\varvec{x}_{j} } \right)} $$
(9)
$$ s(\varvec{x}_{i} ,\varvec{x}_{j} ) = \left\| {\varvec{x}_{i} - \varvec{x}_{j} } \right\|\, $$
(10)
$$ l(i) = \sum\limits_{j = 1}^{m\, \times \,n} {c\left( {\varvec{x}_{i} ,\varvec{x}_{j} } \right)} \, $$
(11)

And

$$ c(\varvec{x}_{i} ,\varvec{x}_{j} ) = \left\| {i - j} \right\|^{2} $$
(12)

Then the noisy pixel is replaced with the output of the exponentially weighted mean filter given as

$$ \varvec{x}_{Ewmf} = \frac{{\sum\nolimits_{i = 1}^{m \times n} {w_{i} \varvec{x}_{i} } }}{{\sum\nolimits_{i = 1}^{m \times n} {w_{i} } }} $$
(13)

Abiding by the normalization procedure, two constraints are necessary to make it sure that the output of Ewmf is an unbiased one, namely: (a) each weight \( y_{i} = \frac{{w_{i} \,}}{{\sum\nolimits_{i = 1}^{m\, \times \,n} {w_{i} } }} \) for a respective vector pixel x i is a positive number, y i  ≥ 0 and (b) \( \sum\nolimits_{i}^{m\,\, \times \,n} {y_{i} = 1} \). The parameters α, η and β are used to tune the amount of weight to be given to the pixels. To obey the above constraints so that the output is unbiased, it is made that \( \eta = 1 - \alpha \) where \( 0\, < \,\,\alpha \,\, < \,\,1 \) since the values of d(i) and l(i) will be in the range of k where \( 0\, \le k\,\, < \infty \) excluding \( 0\, < k\, < 1 \). And β is the value of α at which the weighting function w i takes the maximum derivative. The value of η = 1 − α also makes it sure that the two components in Eq. 8 are dependent and correlated to each other according to the noise probability of the sliding window. The first component described by Eqs. 9 and 10, depends on the cumulative distance of intensity difference of each pixel from its surrounding neighboring pixels. If the value of d(i) for a particular pixel x i is larger, than it means that the intensity difference of the particular pixel from its surrounding is very large and has more tendencies to be an impulse noisy pixel. Therefore less weight is given to the pixel and vice versa. Whereas the second component as described by Eqs. 11 and 12, depends on the cumulative distance of coordinate or position difference of the pixel from its surrounding pixels. It is based on the fact that a pixel which is far away from the center pixel spatially is of less importance. Therefore a pixel x i with a large value of l(i) is far away from the center pixel x(p,q) and is of less resemblance or importance, to be assigned with less weight. And it can be also seen that the parameters α and η are inversely proportional to the weight w i .

Further for a particular value of d(i) and l(i), the amount of weight assigned is again controlled by the respective values of α and η. If any of α or η is having a value of 1 then the other will be 0 that avoids the condition for both the components to be considered simultaneously. The condition that \( \eta = 1 - \alpha \) makes it achievable that, for the window with a comparatively lesser number of 0 s and 255 s in the region of \( p_{r} \, > \,T_{H} \) and with a lesser value of d(i), more weight is allowed to be assigned to the pixel by the first component of Eq. 8 with a lesser value of α, thus highlighting the first component, that subsequently makes the second component which is made of l(i) to be less important with a comparatively higher value of \( \eta = 1 - \alpha \). Whereas in the window with more number of 0 s and 255 s which usually has a higher value of d(i), less weight is made to be assigned by the first component with higher value of α and thus the second component is given more importance with a comparatively lesser value of \( \eta = 1 - \alpha \). This fact is supported by the results in Tables 1 and 2 where the values of NCD, PSNR, MAE and TIME are listed at different noise ratios and at different values of α and η for fixed valued and random valued noise correspondingly. And the values of α and η at which the value of PSNR and other measuring parameters attain their maximum values is highlighted. The selection of values for the parameters is further discussed in part C: Parameter selection, of section III.

Table 1 Various measuring criteria and their values at different values of α and η at different noise ratio, for the proposed filter for FVN
Table 2 Various measuring criteria and their values at different values of α and η at different noise ratio, for the proposed filter for RVN

Filter evaluation

The filters are evaluated in this section on a variety of RGB color images, which includes scientific images, biomedical images, photographic images, synthetic images and a group of images generally used in the color image processing literature, for a better comparison on the performance of the filters, by considering a 3 × 3 window size with L 1 and L 2 norms. Figure 4 shows the 12 representative images of Lena image, Mandrill, Airplane, Aptus, Barbara, Brain, Couple, Girl, Gold hill, House, Lake and Miramar.

Fig. 4
figure 4

Test images: a Lena, b Mandrill, c Airplane, d Aptus, e Barbara, f Brain, g Couple, h Girl, i Gold hill, j House, k Lake and l Tiffany

Noise model

An impulse noise model which is commonly used in the literature of filtering of color images is used in this work (Viero et al. 1994). Let b be the probability of corruption of the color image with the impulse noise. A color image has three vector components, where each component has a chance of being corrupted by the impulse noise with a respective corruption probability. Let b R , b G and b B be the probabilities of impulse noise corruption of the three components R, G and B respectively.

$$ \varvec{y} = \left\{ \begin{array}{l} x\,{\text{with}}\,{\text{probability}}\,\,1 - b \hfill \\ \left\{ {n_{R} ,x_{G} ,x_{B} } \right\}\,{\text{with}}\,{\text{probability}}\,\,b.b_{R} \hfill \\ \left\{ {x_{R} ,n_{G} ,x_{B} } \right\}\,{\text{with}}\,{\text{probability}}\,\,b.b_{G} \hfill \\ \left\{ {x_{R} ,\,x_{G} ,n_{B} } \right\}\,{\text{with}}\,{\text{probability}}\,\,b.b_{B} \hfill \\ \left\{ {n{}_{R},n_{G} ,\,n_{B} } \right\}\,{\text{with}}\,{\text{probability}}\,\,[1 - (b_{R} + b_{G} + b_{B} )].b \hfill \\ \end{array} \right. $$
(14)

\( \varvec{x} = \left\{ {x_{R} ,x_{G} ,x_{B} } \right\} \) and \( \varvec{y} = \left\{ {y_{R} ,y_{G} ,y_{B} } \right\} \) represent the original and the corrupted vector pixels respectively. And the impulse noise is represented by the random vector \( n = \left\{ {n_{R} ,n_{G} ,n_{B} } \right\} \) which can be a vector of 0 or 255 or both. The images are induced with both fixed valued noise and random valued noise with noise ratio ranging from 10 to 90%. For the fixed valued noise, η k can be either 0 or 225, whereas it can be any random value ranging from 0 to 255 for the random valued noise.

Filter performance measurements

Execution time, mean absolute error (MAE) (Singh and Bora 2014), normalized color difference (NCD) (Singh and Bora 2014) and peak signal to noise ratio (PSNR) (Plataniotis and Venetsanopoulos 2000) are the performance measuring parameters which will be used to evaluate the filters in comparison. Color chromaticity preservation capability of a filter is measured with NCD. A filtered image is said to preserve its chromaticity if it is free from the shadowy effects whereas MAE represents the noise suppression and the signal–detail preservation capability. MAE is mathematically expressed as

$$ MAE = \frac{1}{3PQ}\sum\limits_{i = 1}^{P} {\sum\limits_{j = 1}^{Q} {\left[ \begin{array}{l} \left| {x(i,j)^{R} - x_{F} (i,j)^{R} } \right| + \left| {x(i,j)^{G} - x_{F} (i,j)^{G} } \right| \hfill \\ + \left| {x(i,j)^{B} - x_{F} (i,j)^{B} } \right| \hfill \\ \end{array} \right]} } $$
(15)

\( \varvec{x}(i,j) \) and \( \varvec{x}_{F} (i,j)\, \) are the original and the filtered image respectively. \( \left\{ {x(i,j)^{R} ,x(i,j)^{G} ,x(i,j)^{B} } \right\} \) and \( \left\{ {x_{F} (i,j)^{R} ,x_{F} (i,j)^{R} ,x_{F} (i,j)^{R} } \right\} \) are the red, green and blue components of the original image \( \varvec{x}(i,j) \) and filtered image \( \varvec{x}_{F} (i,j) \) respectively. It can be seen that with the help of the above equation a slight difference between the original and filtered image can be highlighted properly for better comparison between the filters. The NCD is defined in the \( L\,u^{*} \,v^{*} \) color space by

$$ NCD = \frac{{\sum\nolimits_{i = 1}^{P} {\sum\nolimits_{j = 1}^{Q} {\left\{ {\left| {L(i,j) - L_{F} (i,j)\,} \right|^{2} + \left| {u\,\,(i,j) - u\,_{F} \,(i,j)\,} \right|^{2} + \left| {v\,(i,j) - v_{F} \,(i,j)\,} \right|^{2} } \right\}} }^{1/2} }}{{\sum\nolimits_{i = 1}^{P} {\sum\nolimits_{j = 1}^{Q} {\left\{ {\left| {L\,(i,j)\,} \right|^{2} + \left| {u\,(i,j)\,} \right|^{2} + \left| {v\,\,(i,j)\,} \right|^{2} } \right\}} }^{1/2} }} $$
(16)

where \( \left\{ {L(i,j),u\,\,(i,j),v\,(i,j)} \right\} \) and \( \left\{ {L_{F} (i,j),u\,_{F} \,(i,j),v_{F} \,(i,j)} \right\} \) are the respective values of the lightness and two chrominance components of the original image \( \varvec{x}(i,j) \) and filtered image \( \varvec{x}_{F} (i,j) \). And the signal content of the image is described by PSNR which is expressed as

$$ PSNR\, = \,10\,log\,_{10} \,\frac{{x^{2}_{max} }}{{\frac{1}{3PQ}\sum\nolimits_{i = 1}^{P} {\sum\nolimits_{j = 1}^{Q} {\left\| {x(i,j) - x_{F} (i,j)} \right\|} }^{2} }} $$
(17)

where \( x_{max} = 2^{b} \, - 1 \) is the maximum intensity for an image in a particular channel. 24 bits images of size 512 × 512 are considered in this work, where b = 8, is the number of bits in a pixel for the particular channel and x max is equal to 255.

Parameter selection

The exponential weight is found using Eq. 6 where the weight is controlled by the three parameters α, η and β. As seen from the weight equation, α and η are inversely proportional to the weight as seen in Eq. 8. Analyzing the simulation results on the various images, it is found that at the lower noise ratio, 10% and 20% as representative in this work, the PSNR attains its maximum value at lower value of = 0.4 and comparatively higher value of η = 0.6, supported by the fact that more weight is given by the first component \( d(i)^{\alpha } \) in Eq. 8 to the pixels at lower noise ratio, during which most of the pixels in the window tends to be less impulse. Whereas the PSNR attains its maximum value at a relatively higher value of around α = 0.6 or 0.7 and comparatively lower value of η = 0.4 or 0.3 for higher noise ratio, during which less weight is necessary by the pixels in the window from the first component \( d(i)^{\alpha } \) and instead more from the second component \( l(i)^{\eta } \) is considered, since their probability to be impulse is more. Therefore \( \alpha = 0.7\,,\,\eta \, = 0.3 \) and \( \alpha = 0.6,\,\,\eta \, = 0.4 \) are considered for the highest noise ratio (80 and 90%) with relatively smaller value of α = 0.4 and higher value of η = 0.6 for lower noise ratio (10 and 20%) for fixed valued noise and random valued noise respectively (see Tables 1, 2). The above discussion concludes that the first component controlled the parameter α plays a bigger role as compared to the second component controlled by parameter η in Eq. 8. The values of β and \( \partial \) are set as 1 and 0.5 respectively. Considering the Eqs. 4 and 5 which represents the expression for ACWVMF, the value of ν is considered as 3 so that u goes from 3 to 5, for which three different x CWVMF is calculated with three different \( w_{j} (u) \) respectively. The values of T L and T H in Eq. 3 are set as 0.000 and 0.111 respectively. The parameters and their respective values selection, for both fixed valued and random valued noise, for other filters in comparison are shown in Table 3.

Table 3 Filters in comparison (excluding the proposed filter), with their respective parameters’ values at which the filters are implemented

Comparison with other existing filters

The performance comparison of the various filters is shown in Tables 4 and 5. Figure 5 shows the graphical comparison of the MASVMF_MEAN, VMF, ACWVMF, EVMF, ASVMF_MEAN, RCTVMF, NVMF, SDM and NCVMF_1nc. The PSNR which defines the signal content of the filtered image has been given more importance for comparing the performance. Filters like ACWVMF, ACWVDF, NVMF and PGF perform very well in lower noise ratio and also work efficiently in higher noise ratio. The RCTVMF and MCWVMF are very efficient in preserving the signal content in the lower noise ratio but perform inefficiently in the higher noise ratio. Whereas the EVMF and the vector sigma group of filters namely the ASDDF_RANK, ASVMF_MEAN, ASDDF_MEAN work efficiently in higher noise ratio although not very well in the lower noise ratio as compared to the case of ACWVMF and its allies mentioned above. But generally it can be clearly seen that the Adaptive switching filters like the Adaptive center weighted vector filters, Vector sigma filters, Adaptive vector filters and entropy based vector filters, first detect the noisy pixels using certain noise detection algorithm, before replacing the center pixel with the output of some vector filter and thus is able to give higher PSNR values than those of the non adaptive switching filters like the basic vector filters, fuzzy weighted filters etc. Therefore the adaptive switching filters are able to restore the original find details of the image better than the non-adaptive filters.

Table 4 Comparison of the filters for the Lena image induced with FVN at 10, 20, 80 and 90% based on NCD, PSNR, MAE and TIME
Table 5 Comparison of the filters for the Lena image induced with RVN at 10, 20, 80 and 90% based on NCD, PSNR, MAE and TIME
Fig. 5
figure 5

Comparison of some robust filters graphically: a legends depicting the filters in comparison and be shows execution time, PSNR, NCD and MAE comparison for fixed valued impulse noise; fi shows execution time PSNR, NCD and MAE for random valued impulse noise

After working on various numbers of images it can be seen that the proposed filter, Noise percentage based switching filter maintains a good PSNR value at lower noise ratio by outperforming robust filters like ACWVMF, ACWVDF, etc. and also definitely overtakes even the most robust filters, which are very efficient in the higher noise ratios, like ACWVMF, EVMF and some vector sigma filters. This is supported by the experimental results shown in the Tables 4 and 5, where the results of some efficient filters in consideration are christened. Figures 6 and 7 show the original images, corrupted images with 90% of fixed valued and random valued impulse noise and filtered images of Tiffany and Tree respectively. The filtered images of the proposed filter are shown in image l of the Figs. 6 and 7, depicting high signal content and detail preservation. But seen precisely the filtered images are little blurred since the noisy pixels are replaced by the output of the average of the exponentially weighted filter. And also the proposed filter can be further improved in terms of preservation of chromaticity by furthering lowering the value of NCD.

Fig. 6
figure 6

Filtering results for the TIFFANY image corrupted with 90% noise: a original, b 90% noisy, c ASVMF_MEAN, d ASVMF_RANK, e ASDDF_MEAN, f ASDDF_RANK, g VMF, h MCWVMF, i NVMF, j RSVMF, k RCTVMF and l MASVMF

Fig. 7
figure 7

Filtering results for the TREE image corrupted with 90% noise: a original, b 90% noisy, c ACWDDF, d ACWVDF, e ACWVMF, f AVDF, g AVMF, h EDDF, i EVDF, j EVMF, k FVMF and l MASVMF

Conclusions

The proposed filter is able to outperform the other robust filters, in maintaining the signal content and preserving the fine details of the image corrupted with fixed valued and random valued impulse noise at the lower noise ratios as well as at the higher noise ratios. And the filter also maintains the chromaticity of the filtered image at a lower value of NCD and MAE as compared to some of the very efficient filters in literature. The weighted average output of the filter does not belong to the vectors in the window because of which the filter can be extended further for Gaussian noise and mixed Gaussian and impulse noise removal. Other than this, an unwanted commonly occurring issue called smoothing can be still further minimized. Future work will be in introducing a directional distance factor in the exponential weight function so that the chromaticity maintenance of the image is improved further.

References

  • Asif A (2004) Fast Rauch–Tung–Striebelsmoother based image restoration for noncausal images. IEEE Signal Process Lett 11:371–374

    Article  ADS  Google Scholar 

  • Asif A, Moura JMF (1996) Image codec by noncausal prediction residual mean removal and cascaded VQ. IEEE Trans Circuits Syst Video Technol 6:42–55

    Article  Google Scholar 

  • Astola J, Haavisto P, Neuvo Y (1990) Vector median filters. Proc IEEE 78:678–689

    Article  Google Scholar 

  • Celebi ME, Aslandogan YA (2008) Robust switching median filter for impulsive noise removal. J Electron Imaging 17:043006-1–043006-9

    ADS  Google Scholar 

  • Celebi ME, Kingravi HA, Aslandogan YA (2007) Nonlinear vector filtering for impulsive noise removal from color images. J Electron Imaging 16(3):033008

    Article  Google Scholar 

  • Daniel John S (2013) Bilateral filter extension for removal of universal noise. Int J Latest Trends Eng Technol 2(3):235–241

    Google Scholar 

  • David S, Ramamurthi B (1991) Two-sided filters for frame-based prediction. IEEE Trans Signal Process 39:789–7994

    Article  ADS  Google Scholar 

  • Hu JH, Wang Y, Cahill PT (1997) Multichannel application in magnetic resonance images. IEEE Trans Image Process 6:1155–155566

    Google Scholar 

  • Karakos D, Trahanias P (1995) Combining vector median and vector directional filters: the directional distance filters. IEEE Proc ICIP 1:171–174

    Google Scholar 

  • Kaur M, Gupta S, Bhusan B (2015) An improved adaptive bilateral filter to remove gaussian noise from color images. Int J Signal Process Image Process Pattern Recognit 8(3):49–64

    Article  Google Scholar 

  • Kenny C, Deng Y, Manjunath BS, Hewer G (2001) Peer group image enhancement. IEEE Trans Image Process 10:326–334

    Article  ADS  MathSciNet  MATH  Google Scholar 

  • Lukac R (2002) Colour image filtering by vector directional order statistics. Pattern Recognit Image Anal 12:279–285

    Google Scholar 

  • Lukac R (2003) Adaptive vector median filtering. Pattern Recognit Lett 24:1889–1899

    Article  Google Scholar 

  • Lukac R (2004) Adaptive color image filtering based on center weighted vector directional filters. Multidimens Syst Signal Process 15:169–196

    Article  MATH  Google Scholar 

  • Lukac R, Smolka B (2003) Application of the adaptive center weighted vector median framework for the enhancement of cDNA microarray images. AMCS Int J Appl Math Sci 13:369–383

    MathSciNet  MATH  Google Scholar 

  • Lukac R, Smolka B, Plataniotis KN, Venetsanopoulos AN (2003) Generalized entropy vector filters. In: Proceedings of the EURASIP EC-VIP-MC conference, pp 239–244

  • Lukac R, Smolka B, Plataniotis KN, Venetsanopulos AN (2006) Vector Sigma filters for noise detection and removal in color images. J Vis Commun Represent 17:1–26

    Article  Google Scholar 

  • Malinski L, Smolka B (2015) Fast averaging peer group filter for the impulsive noise removal in color images. J Real-Time Image Proc 11:427–444

    Article  Google Scholar 

  • Moore MA, Gabbouj M, Mitra SK (1999) Vector SD-ROM filter for removal of impulse noise from color images. In: Proceedings of the 2nd EURASIP conference, Krakow, Poland, ECMCS, No. 89

  • Morillas S, Gregori V, Sapna A (2011) Adaptive marginal median filter for color images. Sensors 11:3205–3213

    Article  PubMed  PubMed Central  Google Scholar 

  • Pitas I (1990) Marginal order statistics in color image filtering. Opt Eng 29:495–503

    Article  ADS  Google Scholar 

  • Plataniostis KN, Androutsos D, Vinayagamoorthy S, Venetsanopoulos AN (1996) An adaptive nearest neighbor multichannel filter. IEEE Trans Circuits Syst Video Technol 6:699–703

    Article  Google Scholar 

  • Plataniostis KN, Androutsos D, Venetsanopoulos AN (1999) Adaptive fuzzy systems for multichannel signal processing. Proc IEEE 87:1601–1622

    Article  Google Scholar 

  • Plataniotis KN, Venetsanopoulos AN (2000) Color image processing and applications. Springer, Germany

    Book  Google Scholar 

  • Singh KhM (2012) Vector median filter based on non-causal linear prediction for detection of impulse noise from images. Int J Comput Sci Eng 7:345–355

    Article  Google Scholar 

  • Singh KhM, Bora PK (2003) Noncausal vector linear prediction filter. WSEAS Trans Circuits Syst 2:1211–1219

    Google Scholar 

  • Singh KhM, Bora PK (2004) Adaptive vector median filter for removal of impulse noise from color images. J Electr Electron Eng 4:1063–1072

    Google Scholar 

  • Singh KhM, Bora PK (2014) Switching vector median filters based on non-causal linear prediction for detection of impulse. Imaging Sci J 62:313–325

    Article  Google Scholar 

  • Smolka B, Chydzinski A (2005) Fast detection and impulsive noise removal in color images. Real Time Imaging 11:389–402

    Article  Google Scholar 

  • Smolka B, Lukac R, Plataniotis KN (2012a) New algorithm for noise attenuation in color images based on the central weighted vector median filter. In: Proceedings of the 9th international conference on systems, signals and image processing. IWSSIP, Manchester, pp 544–548

  • Smolka B, Malik K, Malik D (2012b) Adaptive ramk weighted switching filter for impulsive noise removal in color images. J Real-Time Image Proc 10:289–311

    Article  Google Scholar 

  • Sun T, Neuvo Y (1994) Detail-preserving median filters in image processing. Pattern Recognit Lett 15:341–347

    Article  Google Scholar 

  • Tomashi C, Manduchi R (1998) Bilateral filtering for gray and color images. In: Proceedings of the IEEE international conference on computer vision, pp 839–846

  • Trahanias PE, Venetsanopoulos AN (1992) Vector directional filters: a new class of multichannel image processing filters. IEEE Trans Image Process 2:528–534

    Article  ADS  Google Scholar 

  • Viero T, Oistamo K, Neuvo Y (1994) Three dimensional median-related filters for color image sequence filtering. IEEE Trans Circuits Syst Video Technol 4:129–142

    Article  Google Scholar 

Download references

Authors’ contributions

KPD conceived and designed the new noise percentage based switching filter (NPSF) that works well both in higher and lower noise ratio, drafted and revised the manuscript. KMS helped in the design of the study, cross-checked and verified the new algorithm. LLS helped to draft and revise the manuscript. All authors read and approved the final manuscript.

Competing interests

The authors declare that they have no competing interests.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to K. Pritamdas.

Rights and permissions

Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Pritamdas, K., Singh, K.M. & Singh, L.L. An adaptive switching filter based on approximated variance for detection of impulse noise from color images. SpringerPlus 5, 1969 (2016). https://doi.org/10.1186/s40064-016-3644-9

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1186/s40064-016-3644-9

Keywords