A Particle Swarm Optimization Based Edge Preserving Impulse Noise Filter

Problem statement: Image sensors and communication channels often introduce impulse noise in image transmission. The most common filters available to remove such noise are median filter and its variants but the major drawbacks identified with them are blurring of edge detail and low noise suppression. To preserve the sharp and useful information in the image, the filtering algorithms are required to have intelligence incorporated in them. Approach: This research proposed a particle swarm optimization based approach in the design of filter. The filter weights were adapted and optimized directionally to restore a corrupted pixel in a mean square sense. Results: This results in replacement of noisy pixels by near originals along its edge direction. Various objective parameters like Mean Absolute Error (MAE), percentage of noise elimination, percentage of pixels spoiled showed that the proposed recursive no-reference filter performs 4dB better than the competing filters. Conclusion: This research aimed at presenting a new filtering framework for impulse noise removal using Particle Swarm Optimization (PSO).


INTRODUCTION
Images often suffer from impulse noise due to the errors generated in sensory devices or communication channels.To remove impulse noise, various statistical filters have been developed in the literature (Pitas and Venetasanopoulas, 1990;Ko and Lee, 1991;Xu and Mille, 2004;Jiang, 2003;Harandi and Arabbi, 2003;Crnojevic et al., 2004;Chen et al., 1999;Chan et al., 2005a;Jones and Agah, 2002).The most widely recognized statistical filter is the median filter which is an effective technique to remove impulsive noise from images (Pitas and Venetasanopoulas, 1990).A detail preserving statistical filter with a weight adjustment factor for the centre pixel was introduced by Ko and Lee (1991).A filter that truncates the gray value of a pixel to the maximal or minimal value of its enclosed surrounding band is presented in (Jiang, 2003).Impulsive noise inside the band is attenuated while image details are preserved as long as they are within the band.This filter outperforms the Simple Median (SM) and Center Weighted Median (CWM) filters in respect of corrupted images with medium noise density.Harandi and Arabbi (2003) proposed an algorithm using the Long-range correlation information to find the gray level of degraded pixels (Harandi and Arabbi, 2003).A novel nonlinear filter, called Tri-State Median (TSM) filter, that incorporates SM filter and CWM filter to preserve the image details while suppressing impulse noise is presented in (Chen et al., 1999).Even though a median filter and its variants usually perform impulse noise removal effectively, they destroy the image signal structure (edges) and hence the image gets blurred.In this scenario there is a need for adapting the filter weights to the direction of edges accordingly.Optimization tools like Genetic Algorithm (GA), Particle Swarm Optimization (PSO) can play a role in optimizing the filter weights to preserve the edges.Vertan et al. (1997) have used GA to optimize L-filter using an artificially generated test training image.In noise filtering approaches (Vertan et al., 1997;Hamid et al., 2003;Lukac et al., 2004;Zhou and Shen, 2006;Eberhart and Kennedy, 1995;Shi and Eberhart, 1998) that incorporate GA, the original image has been used as target while optimizing the filter.A part of the original image is used to train the prominent parameters like tap weights of the filter.But having the original image itself at the receiver section in any communication system is not always feasible.Thus the independence of the noise filter with respect to the original image (No-Reference Filter) can make the filtering process, self evolutionary.The proposed self evolutionary filter uses PSO further to adapt weights of the filter.This study commences with an introduction about the filtering techniques.The Selective Filtering Framework has been explained following a brief about the Impulse Noise model.It concludes with a detailed explanation about the proposed filtering algorithm justified by the Results and Discussion.

MATERIALS AND METHODS
The proposed methodology describes a selective filtering scheme that utilizes an impulse noise detection scheme to fix the corrupted pixels in the input image.
A recursive algorithm is proposed to estimate the corrupted pixel selectively over the noisy portions in the corrupted image.
Impulse noise image model: Let I n (x,y) with 1<x<y and 1<y<Y be the expected noise affected image of size (X,Y) received at the receiver.The noisy image can be represented as: I(x,y) with probability 1-P 1 -P 2 I n (x,y) = I S with probability P 1 (1) I P with probability P 2 Where: I(x,y) = The original transmitted image I S , I P = The constant amplitudes corresponding to the maximum (salt) and minimum (pepper) intensity of the peak noise P 1 , P 2 = The probabilities of occurrence of pixel being corrupted by maximum and minimum impulsive noise respectively Selective filtering: One of the main assumptions on the classical filters (Gonzalez and Woods, 1992) is that all input samples are unconditionally affected by the filtering process.In the presence of impulse noise model stated above, this approach is not optimal since in contrast to continuous noise distributions, only certain samples of the original signal are corrupted and others remain unaffected.The noise η is characterized by the magnitude of the impulses and their probability of occurrence 'p'.Since 'p'<< 1 mostly, it is useful to filter an input sample, to reduce blurring of the signal.Thus, the filtering process consists of two parts: • Ascertaining whether the input sample considered (center pixel in the processing window) is corrupted by an impulse • In such case replacing the corrupted samples by a value estimated from its neighbors.Otherwise passing the samples to the output unprocessed.Such scheme is shown in Fig. 1 It is important to note that the impulse detection makes decision only about one sample in the observation window and that this sample is processed immediately afterwards.

Proposed method:
The proposed filter uses No-Reference technique making the filtering process self evolutionary, which uses only selective pixels of the corrupted image as the reference and operates only over noisy locations.The filter weights are optimized in such a way that they are qualified as the robust weights with the fitness function evaluation.Figure 2 shows the structure of proposed Particle Swarm Optimization based edge preserving impulse noise Filter (PSOF).Impulse noise detection: An Adaptive median filter based impulse detector that detects impulses accurately is used in this approach (Chan et al., 2005b).An image window W around a pixel X p,q is defined as: Where: 'm' = A positive integer that determines the window size (p,q) = The index of the current pixel The corrupted pixels belong to a set {W min , W max }, where W min is the minimal pixel value in the defined window and W max is the maximum.Adaptive median filtering to the corrupted image X i,j yields a filtered image M. A corrupted pixel signifying the presence of noise is assigned a flag matrix 'f ' given by: Edge detection: The edge of the image is obtained with the prewitt filter mask and flagged (Fig. 3).When the noisy pixels are on edges, the non noisy pixels along that edge are considered in filtering process.

PSO based filter:
A linear filter is proposed with an adaptive window structure in which each noisy pixel is replaced by its neighborhood pixels weighted with the random weights provided by PSO.The following steps give the flow of the filtering scheme: • A local vector L + {l 1 , l 2 ,…,l N } is formed with noisy pixels at locations given by the flag matrix f. • For each element in the local vector L, form a search region S m whose size m×m is adaptive, as there are insufficient good pixels around a noisy pixel.This situation arises when the noise density goes higher.The size of the search region m×m varies as: where, τ 1 and τ 2 are the predefined threshold values that define the number of non-noisy pixels for each window (say if more than 50% of total number of pixels in the operating window is corrupted then the search region has to be switched to the next possible window).N 1 is the number of non-noisy pixels in 3×3 window and N 2 is the number of non-noisy pixels in 5×5 window • A candidate vector C N = {c 1 , c 2 ,….cN } whose elements are the pixel locations from the search region S m but not the member of L, is defined as: Let P N = {p 1 , p 2 ,…, p N } be the vector of nonnoisy pixels corresponding to the elements in the vector C N .
. The image is restored by applying the weights A MN Directional optimization of filter weights: Exploiting the impact of inter-pixel redundancy (Gonzalez and Woods, 1992) of a pixel over the surrounding neighbors due to the external lighting conditions, the estimating strategy is devised as to minimize the Mean Square Error between the filtered pixel and the neighboring non-noisy pixels.The error minimization is achieved by finding the prominent four directions in which the filtered pixel actually orients with a minimal error.Figure 4 represents a 5×5 window with 's' as the filtered pixel, along with pixels in four different directions given by D1, D2, D3 and D4.With the fixed 5×5 window being taken around the filtered pixel, the deviation of the filtered pixel î from other non-noisy pixels in the directions D 1 (90°), D 2 (0°), D 3 (45°) and D 4 (135°) is found individually using: where, D ki denotes the i th non-noisy pixel present in the direction k and 'n' denotes the number of non-noisy pixels in the direction k.The minimum error produced with the filtered pixel is the direction in which the filtered pixel actually orients.Hence the optimization is performed only in the direction j = min(DMSE k ), k = 1,2,3,4, j∈(1,,2,3,4) such that the weights A are optimized to make it orient towards the actual direction that is found.For the successive generations, the non-noisy pixels d j in j th direction are used to satisfy the objective function (minimum mean square error).The proposed filter is recursive in nature which means that, the filtered pixel will be able to take part in the course of filtering the noisy pixel.Once the i th noisy candidate has been filtered, correspondingly the flag matrix gets updated such that the respective location in the local vector L is removed.This can be achieved by:

., N and k i
l k denotes the location of the noisy pixels filtered in the previous iterations.
Optimization of filter weights: Traditional search methods using Calculus, Enumeration and Random Walks, fail in many circumstances to find strong solutions.Thus we migrate towards Evolutionary Techniques such as Genetic Algorithm, PSO to optimize the filter weights.Particle Swarm Optimization begins with an initial set of random solution.Each potential solution in the set called particle is given a random velocity and is propagated through the problem space.The particles have memory and share information of their previous best position and the over all best position ever traveled by a particle in the swarm.The algorithm of the PSO weight adaptation is given below.

Algorithm:
The PSO algorithm employed to optimize filter weights is as follows: • Initialize the weights x i and the rate v i for all i • Let n be the size (population) of solution space Let the fitness function f be the mean square error defined as: For every member 1≤ i ≤ n of the solution space: • Generate learning factors w, c 1 , c 2 and the random values b 1 , b 2 • Update the rate as: Update the weights as: • When f(x i )<f(P id ), update the Individual Best (P id ) for i (particle), the set of weights that yields the Fitness value) minimum MSE • When f(P gd )<f(x i ), update the Global Best (P gd ), the set of weights that yields the minimum MSE in a global sense (i.e.,) Best of Individual Best's The above algorithm is iterated until: This convergence yields P gd , the optimal set of weights A ij that minimizes Mean Square Error.With the set P gd as weights, the filter now estimates the corrupted pixel I as: where, P ij is the vector of non-noisy pixels.

RESULTS
Standard grayscale test images of size 256×256 photographic images like 'Lena', 'Cameraman', 'Mandrill', an X ray and a SAR image have been used for experimentation.As a justification, a photographic image 'Lena', an X-ray image of a 'hand' and a SAR image are shown here.

DISCUSSION
The 'Lena' image has been corrupted by impulse noise to various levels ranging from 10-90%.Nonlinear filters like Simple Median, SD-ROM, Progressive Switching Median (PSM), Centre Weighted Median (CWM), PWMAD and Recursive Adaptive Median Filter (RAMF) have been used for comparison using the metric Peak Signal to Noise Ratio (PSNR).
The population size used in PSO has very less influence on the optimality of the final solution.A population with three individuals was used and the maximum number of iterations allowed was five as for higher values the improvement in the final solution was not significant.The value of ε is considered as 0.0001 To evaluate the performance of proposed PSOF, the standard metric Peak Signal to Noise Ratio (PSNR) has been used as defined in ( 13): ) Most of the non-linear filters fail to preserve the sharp details in the image while the proposed method preserves the edges carefully in the way that it minimizes the error directionally.Being recursive, the filter performs well in higher noisy cases where the chance of getting non-noisy pixels is less.The zoomed part of the filtered image at 70% noise is shown in Fig. 6 in comparison with both RAMF output and original Lena image.The proposed filter detects the direction in which the noisy pixel is being oriented and minimizes the MSE in that direction.
Figure 7 shows comparison of PSNR, for various noise levels and for various filters.It is evident that the proposed method outperforms the existing techniques even at higher noise level of 80% and provide a average Processing Gain of approximately 0.7 dB over its nearest performing filter.As an extension to the quantitative analysis, four different measures namely the percentage of noisy pixels replaced with original, eliminated, modified and the amount of original pixels being spoiled by the filter techniques.Table 1 shows the performance of various filters on 40% corrupted image in comparison with the proposed filter.
The noisy image of a SAR and an X ray image is obtained by adding 40% of impulse noise.These noisy images are subjected to the proposed PSO filter for the removal of noise is shown in Fig. 8 and 9.The PSNR value obtained by denoising the noisy SAR and X ray images is improved.

CONCLUSION
This research aimed at presenting a new filtering framework for impulse noise removal using Particle Swarm Optimization (PSO).Filter weight Optimization has been used to adapt the weight that minimizes the error in the mean square sense.Extensive simulations were carried out on a variety of images through appropriate PSO parameters.The Quality metrics obtained over existing and proposed technique suggest that proposed filter performs better even at 80% of noise.

Fig. 3 :
Fig. 3: Prewitt filter mask possible intensity of the image ((i.e.,) 255 for 8 bit image) The Fig. 5 provides the results of filters for 60% noise corrupted Lena image.Lena image corrupted with 60% of impulse noise is shown in Fig. 5a.Various conventional filter algorithms are applied on the noisy Lena image and the corresponding results are shown in Fig. 5 b-g.The proposed PSO based algorithm's result is shown in Fig. 5h.

Fig. 5 :Fig. 6 :Fig. 8 :Fig. 9 :
Fig. 5: Experiment results: (a) Noisy Lena image with noise density 60% ( PSNR-5.79 dB); (b) Center weighted median filter (10.78 dB); (c) PWMAD filter (10.89 dB); (d) SD-ROM filter (11.87 dB); (e) Simple Median filter (12.29 dB); (f) PSM filter (17.76 dB); (g) recursive adaptive median filter (26.43 dB); (h)Proposed PSOF (27.10 dB); (i) Original image The vector P N has been reformulated to P MN = {P 1N , P 2N , P 3N } where P 1N is the number of non noisy pixels in 3×3 window, P 2N is the number of non noisy pixels in 5×5 window excluding P 1N and P 3N is the number of non noisy pixels in 7×7 window excluding P 1N and P 2N • Let A 1N , A 2N and A 3N are the weight vectors generated by PSO during the course of algorithm corresponding to P 1N , P 2N and P 3N respectively such that

Table 1 :
Performance analysis of various filters at 40% noise (Lena)