Keywords

1 Introduction

Images are frequently corrupted by impulse noise, which rapidly reduce image quality, and destroy image structure of texture and details. Median filter has become the most popular method to remove impulse noise in color images (Plataniotis et al. 2000), including vector median filter (VMF) (Astola et al. 1990), basic vector directional filter (BVDF) (Trahanias et al. 1993), and Distance-directional filter (DDF) (Karakos et al. 1997). They sort the vectors of pixels in the filter window using different color distances, such Euclidean distance, angle distance and mixture of Euclidean and angle distance, then select the minimum distance as the output of filter.

These vector median filters is highly effective in removing impulsive noise from color images. However, it tends to smooth image textures and details, especially when noise contamination is high. This is because VMF performs the same smoothing on all pixels without consideration of image local structures. So many improved vector median filters are proposed. Switching vector median filters (SVMF) (Smolka et al. 2005; Malinski et al. 2016) and weighted vector median filters (Li et al. 2006; Jin et al. 2008) are two typical classes of vector median filters.

This paper improves VMF based on local texture analysis, and implements a texture-preserved vector filter. The proposed method first computes the texture complexity of the local neighborhood centered at each pixel according to the texture analysis of the color image. Then, the local neighborhood is classified into smooth region or texture one. Finally, the central pixel in the local neighborhood is smoothed by traditional VMF or weighted VMF, depending on the local neighborhood is smooth region or texture one. Experimental results show that the proposed method obviously outperforms the classical VMF both in noise suppression and in texture and detail preservation.

2 Weighted Vector Median Filter

Let the filter windows size be \( N \), where \( N \) is odd. The pixels inside the filter window are sort from up to down and left to right. Then the pixels inside the filter window centered at pixel \( {\mathbf{x}}_{{{{(N + 1)} \mathord{\left/ {\vphantom {{(N + 1)} 2}} \right. \kern-0pt} 2}}} \) are:

$$ \Omega = \left\{ {{\mathbf{x}}_{1} , \, {\mathbf{x}}_{2} , \ldots ,{\mathbf{x}}_{{{{(N + 1)} \mathord{\left/ {\vphantom {{(N + 1)} 2}} \right. \kern-0pt} 2}}} , \ldots ,{\mathbf{x}}_{N} } \right\} $$
(1)

For the pixel \( {\mathbf{x}}_{k} \) in the window \( \Omega \), calculate the sum of the vector distances (\( L_{2} \) norm) from it to other pixels in the windows firstly:

$$ D_{k} = \sum\limits_{l = 1}^{N} {\left\| {{\mathbf{x}}_{l} - {\mathbf{x}}_{k} } \right\|_{2} } $$
(2)

In this paper, \( L_{2} \) norm (Euclidian distance) is used. Then sort \( D_{1} ,\,D_{2} \,, \ldots ,\,D_{N} \) values in ascending order and find the smallest one among all the \( D_{i} \) values. Finally, the corresponding pixel \( {\mathbf{x}}_{(1)} \) of the smallest distance \( D_{(1)} \) is the output of VMF, that is the central pixel of the window is replaced with \( {\mathbf{x}}_{(1)} \).

Weight vector median filter (WVMF) performs better in noise suppression and detail preservation than classical VMF. Different weights are assigned to pixels in the window, and pixel which are not corrupted or more similar to original pixels should be assigned higher weights.

3 Proposed Detail Preserving Vector Median Filter

The proposed method performs maximum smoothing in the smooth region and less smoothing in the texture region to realize detail preservation. So the texture complexity of the pixel in a local region needs to be computed firstly. Different texture complexity methods have been developed. This paper employs edge information to measure texture complexity. The more edge pixels in a local region, the larger texture complexity of the region should be. However, due to the vector nature, extraction of edges from color images is more challenging than from grayscale images. There are different methods to detect color image edges. For simplicity, this paper uses the edges in luminance image, since human vision is highly sensitive to luminance compared to chromaticity (Ruttiger et al. 2000). We use the Canny edge operator to detect edges in luminance image (Canny 1986). And \( e(x,y) \) denotes the edge image:

$$ e(x,y) = \left\{ {\begin{array}{*{20}l} {1\,,} \hfill & {(x,y)\,is\,an\,edge\,point} \hfill \\ {0\,,} \hfill & {otherwise} \hfill \\ \end{array} } \right. $$
(3)

Let the size of the local region for computing the texture complexity is \( K \times K \). If the pixel \( (x,y) \) locate in the texture region, then there are some edges crossing the region \( \kappa \) where \( (x,y) \) is the central pixel. Typically, there are one or two edges crossing the region. So the texture complexity is computed by

$$ \rho (x,y) = \frac{{\sum\limits_{{(x,y) \in\varvec{\kappa}}} {e(x,y)} }}{K} $$
(4)

The pixel in edge texture region is smoothed by weighted VMF, and others are smoothed by traditional VMF. In other words, if the pixel located in the smooth region (\( \rho (x,y) < 1 \)) or in the texture region (\( \rho (x,y) \ge 1 \)) but is not an edge pixel, we use traditional VMF to smooth. Otherwise, for the edge pixels in the texture region, we use weighted VMF to perform. This paper uses Gaussian weighting function in the weight vector median filter:

$$ w(x,y) = exp\left( { - \frac{{x_{{}}^{2} + y_{{}}^{2} }}{{2\sigma_{{}}^{2} }}} \right) $$
(5)

where the central pixel of the filter window is \( (0,0) \) and \( \sigma \) is the mean variance of Gaussian function to adjust the weight level. Given the same size of the filter window, the more value of \( \sigma \), the more uniform of the Gaussian weights. Then the weighted VMF smooth the noise highly and more details of the image are smoothed. When \( \sigma \to + \infty \), the WVMF degrades into classical VMF. On the contrary, the smaller value of \( \sigma \) is, the greater the difference among the weights. Then the weighted VMF smooth the noise lowly and more details of the image are preserved.

We can use the value of \( e(x,y) \) to judge the pixel \( (x,y) \) is or not located in the edge. However, there are always offset between the actual edge pixel and the detected edge pixel in the process of edge detection, which offset is always one or two pixels. So this paper denotes the pixel \( (x,y) \) is an edge pixel if there is at least one edge pixel in its \( 5\; \times \;5 \) neighbourhood region.

Then output of the proposed detail preserving vector median filter is given by

$$ {\mathbf{y}}^{(\Pr oposed)} \left( {x,y} \right) = \left\{ {\begin{array}{*{20}l} {{\mathbf{y}}^{{({\text{W}}VMF1)}} \left( {x,y} \right) \, ,} \hfill & {\sum\limits_{{(m,n) \in {\mathbf{\Re }}}} {e(m,n)} > 0 \, and \, \rho (x,y) \ge 1 \, and \, \rho (x,y) < 2} \hfill \\ {{\mathbf{y}}^{{({\text{W}}VMF2)}} \left( {x,y} \right) \, ,} \hfill & {\sum\limits_{{(m,n) \in {\mathbf{\Re }}}} {e(m,n)} > 0 \, and \, \rho (x,y) \ge 2} \hfill \\ {{\mathbf{y}}^{(VMF)} \left( {x,y} \right) \, ,} \hfill & {otherwise} \hfill \\ \end{array} } \right. $$
(6)

where \( {\mathbf{\Re }} \) is the \( 5 \times 5 \) neighbourhood region that central pixel is \( (x,y) \), and \( {\mathbf{Y}}^{\Pr oposed} \), \( {\mathbf{Y}}^{VMF} \), \( {\mathbf{y}}^{{(\text{W}VMF1)}} \) and \( {\mathbf{y}}^{{(\text{W}VMF2)}} \) are the outputs of the proposed filter, traditional VMF, and WVMF with the mean variance of Gaussian function in Eq. [5] \( \sigma_{1} \) and \( \sigma_{2} \) (\( \sigma_{2} < \sigma_{1} \)), respectively.

It can be seen from the above equations that in smooth regions the maximum smoothing by traditional VMF will be performed, whereas in texture regions, less smoothing introducing by WVMF, which is determined by parameter \( \sigma \), is carried out. Thus, texture preservation is implemented.

4 Experimental Results

The objective evaluation measures, PSNR (peak signal-to-noise ratio), MAE (mean absolute error), and NCD (normalized color difference) are used to represent the quality of different filters (Plataniotis et al. 2000). The PSNR and MAE are used to measure the performance of noise suppression and structural content (edges, textures, and fine details) preservation, respectively, whereas the NCD is used to quantify the color distortion.

In the proposed algorithm, four tuning parameters \( \Omega \), \( \kappa \), and \( \sigma_{1} \) and \( \sigma_{2} \) need to be fixed. They are set as follows: \( \Omega \) (filter window size) is 3 × 3, \( \kappa \)(neighborhood size for computation of texture complexity) is 7 × 7, and \( \sigma_{1} = 1 \) and \( \sigma_{2} = 0.8 \) (used for WVMF in the Gaussian weighting function). Note that when computation of edges, the color image is preprocessed by 3 × 3 VMF.

The proposed method has been evaluated by an extensive range of tests. Figure 1 shows two test color images, “Lena” and “Parrots” with size of \( 256\; \times \;256 \). And the performance of the proposed method is compared with VMF, BVDF and DDF. Tables 1 and 2 list the experimental results of VMF, BVDF, DDF and the proposed method for Lena and Parrots with noise ratio (NR) of 5%, 10%, 20%, 30%, respectively. It is seen that the proposed method significantly outperforms VMF, BVDF, DDF in terms of all the three criteria. It do well in noise suppression (see PSNR measure), and is effectively in texture and detail preservation (see MAE measure), and preserve color hue (see NCD measure).

Fig. 1.
figure 1

Two test color images

Table 1. The results of VMF, BVDF, DDF and the proposed algorithm for Parrots image with different noise ratio
Table 2. The results of VMF, BVDF, DDF and the proposed algorithm for Lena image with different noise ratio

Figure 2 show the filter images of Parrots with 20% noise ratio which are smoothed by VMF, BVDF, DDF and the proposed method respectively. It can be seen that the proposed method is effective both in noise suppression and in texture and detail preservation.

Fig. 2.
figure 2

Filtered image (Parrots with 20% noise)

Furthermore, to get a better look at the filter image details, Fig. 3 shows the amplification of a part of the filtered image of Lena with 10% noise. Obviously, the proposed method preserves well the image details, especially the parts of the eyes and the hair.

Fig. 3.
figure 3

The amplification of a part of Filtered image (Lena with 10% noise)

5 Conclusions

A detail preserving vector median filter for removal of impulse noise from color images is proposed in this paper. First, by analyzing the edge map of a color image, the original image pixels are classified into texture pixels and non-texture ones. Then, for texture pixels, a weighted VMF is performed, which results in less smoothing in denoising the texture pixels and thus the textures and details are effectively preserved. For non-texture pixels, the traditional VMF is carried out, which ensures that maximum smoothing is performed and thus the smoothness of the non-texture pixels are kept. By this way, the proposed texture-preserved vector filter is implemented. Experimental results indicates the superiority of the proposed method by showing significant performance gains both in noise reduction and detail preservation, compared to the traditional VMF.