Alternative Vector Median Filter Algorithm for Color Images Noise Reduction Mahmoud Hassan Electronics Engineering Department Princess Sumaya University Amman, Jordan Raja’Al-Omari King Abdullah II School for Information Technology Jordan University Amman- Jordan Abstract: -The vector median filter is a well known non-linear vector order statistics filter can reduce noise while preserving image details. This paper presents a practical technique for noise reduction of color images using an alternative vector median filter algorithm. This technique gives comparable results to vector median filter with the advantage of high speed processing .A comparison with vector median filter will be presented. Key-words: Vector median filter, Color images, Noise, Color weights, Standard normalized mean square error, L-norm 1 INTRODUCTION Noise reduction is one of the major issues in image processing [1]. Many concepts are present now for noise suppression. Median filter technique is one of most effective techniques. It is a non-linear spatial domain filter and it has many advantages over other spatial filters that are used for noise reduction. Major advantage of a median filter for grayscale images is reducing noise while preserving image details. Median filtering technique is now perfectly structured for grayscale images (i.e. one channel image) where the pixel consists of only one attribute. Multi–channel images (color images) [2] are now widely used in many applications. Median filters have also been used to filter color images. For color images the application of median filters is not straight-forward. Vector median filters (VMF) have been introduced [3,4] to simulate the concept of median filtering in order to reduce the color image noise. Several methods have been introduced to use the median filters for noise removal such as: An adaptive scalar median filter[5], a vector median filter with weighting[6] and without weighting[4[, a reduced vector median filter[7] and other methods[5,8,9,10,11]. The vector median filters consider the pixel as a vector not a scalar. It is suggesting a single quantity that represents the three attributes of the pixel. This resulting quantity is considered as the ranking value, which later will differentiate one pixel from the other in order to find the median. The major issue of a vector median filter is to transform three perpendicular vectors, Red, Green and Blue to one – dimensional quantity The theory of vector median filter is based on measuring the distance between some selected pixels to all other pixels in the window. The pixel that shows the least sum of distances to the other pixels in the window will be chosen as the median pixels. The mathematical model of the vector median filter is defined as follows [3,4,9]: Assume N-sample vectors {X1, X2, ……, XN}, the output of L-norm operator is given by : VM {X1, X2, …, XN} = XVM where XVM Є {X1, X2, …, XN} and N || Xvm Xi || L ≤ i 1 N || Xj Xi || i 1 th VM is the vector median operator; Xi is the i component of color vector (pixel) values. The implementation of vector median filter is based on L-norm to order vector (pixel) according to their relative magnitude differences. If more than one vector (pixel) 2 ALTERNATIVE VECTOR MEDIAN ALGORITHM The main goal of the vector median filter is to produce a comparable quantity from three vectors (pixels) of a color image. This paper introduces another concept to calculate another comparable quantity. It is the distance of the vector (pixel) from the origin with a weight multiplied by each attribute to make the result unique for each vector (pixel). The mathematical model for this alternative algorithm is presented as follows. Assume P(R, G, B) is a vector (pixel) that consists of three components: Red, Green and Blue. The mapping function D (P) is defined as follows: D (P) = WR * R 2 WG * G 2 WB * B 2 (2) Where R, G and B are the attributes of vector (pixel) P; WR, WG, and WB are color weights attached to each attribute in order to distinguish different vectors (pixels) who share the same values of attributes but in different order. For . L j=1,…N (1) satisfies the condition of above equation, then the closer vector (pixel) to the center of the window will be selected. Vector median filter algorithm is inefficient due to the lengthy calculations needed. example, consider WR =1, WG =2 and WB = 3. Without these weights, two vectors (pixels) such as (20, 70, 90) and (70, 90, 20) will have the same mapping values. So, the weight will eliminate any ambiguity. It follows that mapping function D (P) is unique for each vector (pixel) and it has good indication of the vector (pixel) value. Implementation of above alternative vector median filter is straight forward and as is expected it takes much less processing time when compared with the vector median filter. 3 RESULTS AND COMPARISON STUDY The alternative vector media algorithm was simulated using Java 1.4. An image processing program was generated to achieve the tasks of the algorithm. Possible flowcharts for the two algorithms are shown in Figure 1. The above two algorithms (vector median filter and the alternative median filter) have been applied on a sample image. Figure 2 and Figure 3 shows the filtered images which look very close. Noisy Input Image Noisy Input Image Split the image into windows w (square or rectangle of number of rows and columns) Split the image into windows w (square or rectangle of number of rows and columns) CompX = 0; For each Pixel Xi in the window w DO: For each Pixel Xj in the window find Xi – Xj add absolute value to CompX. For each Pixel Xi in the window w DO: o Calculate the value D(Xi) = W * Ri 2 W * Gi 2 W * Bi 2 R G B Find The Median D(Xi) between the D(X) values resulted. For each Pixel X in the window w let XVM = X SUMVM = 0 Replace the central value in the window with the value of XVM. For each Pixel X in the window w find | X-XVM and add its absolute value to SUMVM For all SUMVM resulted, consider the most close and less from CompX. Take the XVM that caused SUMVM to result as median Pixel. Replace the central value in the window with the value of XVM. W = Next Window No Is w the last window? Yes No (a Save Output Image (Filtered Image) Modified Vector Median Filter Algorithm (b) Is w the last window? (b) Yes Save Output Image (Filtered Image) Vector Median Filter Algorithm (a) Figure 1: flowcharts for: (a) possible vector median filter. (b) modified vector median filter Figure 2: (a) Image 1: Noisy Bridge image by salt. (b) Filtered bridge image using VMF. Figure 3: (a) Image 1: Noisy Bridge image by salt. (b) Filtered bridge image using MVMF. The filtering efficiency for noise removal was measured by a standard approach; the standard Normalized Mean Square Error (NMSE)[9]. Equation (3) represents NMSE. Height W idth NMSE || f (i, j ) f (i, j ) || i 1 2 j 1 * 100 (3) Height W idth || i 1 f (i, j ) || 2 j 1 Equation 3 is very useful for comparison study. Vector median filter requires a large amount of Noisy Bridge (255 x 255) Noisy e-board (Pepper). (464 x 448) Noisy e-board (Salt). (464 x 448) Noisy e-board (Salt & Pepper). (445 x 440) Noisy Lena Image. (512 x 512) time when applied to an image for noise removal. The calculations needed to accomplish the task of Equation 1 are lengthy. Table1 shows a comparison study applied on five degraded images (Figures 3 through 7). As it was expected, Table 1 confirms the advantage of processing time needed to remove the noise and enhance the image. Fortunately, the reduction of processing time did not reduce the expected enhancement as for the vector median filter VMF NMSE (%) Time (s) 24.96 9.87 15.87 29.64 10.12 29.17 21.59 29.16 7.36 38.63 MVMF NMSE (%) Time (s) 24.95 0.73 15.86 2.14 10.10 2.09 21.59 2.01 7.82 2.44 Table 1: Comparison Study between VMF and MVMF Figure 4: (a) Image 1: Noisy Lena Image. (b) Image 2: Filtered Lena Image by MVMF Figure 5: (a) Image 1: Noisy e-board image by pepper. (b) Filtered e-board image using MVMF. Figure 6: (a) Image 1: Noisy e-board image by salt. (b) Filtered e-board image using MVMF. Figure 7: (a) Image 1: Noisy e-board image (salt & pepper). (b) Filtered e-board image using MVMF. 4 CONCLUSION This paper has introduced an alternative median filter algorithm for enhancing color images. The initial comparisons with the vector median filter are encouraging. The alternative vector algorithm is offering two advantages. The first one is a noise removal for color images comparable to the vector median results. The second one is the short processing time needed to enhance an image. The achieved results are based on specific weighted factors. More work will be done to investigate the issues of the proposed color weights and the effect on large images 5 REFERENCES 1. R.G. Gonzalez, and R.E. Woods, Digital Iimage Processing, Second Edition, Prentice Hall, 2002. 2. C. Vertan, M.Malciu,V.Buzuloiu, and V.Popescu, “ Median Filtering Techniques for Vector Valued Signals” , International Conference on Image Processing ( ICIP96 ), pp. 17A4, 1996. 3. A.Koschan, and M.Abidi, “ A Comparision of Median Filter Techniques for Noise Removal in Color Images”, Proc. 7 th German Workshop on Color Image Processing, D. Paulus, J.Denzler (Eds.), Erlangen Germany , Report University of Erlangen Nurnberg, Institute of Computer Science, vol.34, no.15 , pp.69-79 , October 2001. 4. F.Argenti, M.Barni, V.Coppellini and A.Mecocci, “Vector Median Deblurring Filter for Color Image Restoration”, Electronis Letters, vol.27, pp.1899 – 1900, 1991. 5. K.P.Valavanis, J. Zheng and J.M.Gauch, On Impulse Noise Removal in Color Images, Proc. Int. Conf. on Robotics and Automation, Sacramento, Ca, 1991,pp144-149. 6. R. Wichman, K. Oistamo, Q. Liu, M. Grundstrom and Y. Neuvo, Weighted Vector Median Operation For Filtering Multispectral Data, Proc.SPIE 1818, Visual Communications and Image Processing, 1992, pp 376-383. 7. C. S. Regazzoni, and A. Teschioni, A New Approach to Vector Median Filtering Based on Space Filling Curves, IEEE Trans. On Image Processing 6, 1997, pp 1025-1037 8. K.N. Plataniotis and A.N. Venetsanopoulos, Color Image Processing and Applications, SpringerVerlag, , 2000 9. P. Trahanias, and A. Venetsenopoules, Vector Directional Filters - a New Class of Multichannel Image Processing Filters, IEEE Trans . on Image Processing, vol.2, pp. 528 534, 1993. 10. P. Bojarczaki , and S. Osowski, Denoising of Images- a Comparison of Different Filtering Approaches, WSEAS Transactions on Computers, vol. 3, 2004,pp738-743. 11. . S. Manikandan, O. Uma Maheswari and D. Ebenezer, An Adaptive Length Recursive Weighted Median Filter with Improved Performance in Impulsive Noisy Environment, WSEAS Transactions on Electronics, issue 3, vol.1, 2004, pp443-448