Optimum Median Filter Based on Crow Optimization Algorithm

A novel median filter based on crow optimization algorithms (OMF) is suggested to reduce the random salt and pepper noise and improve the quality of the RGB-colored and gray images. The fundamental idea of the approach is that first, the crow optimization algorithm detects noise pixels, and that replacing them with an optimum median value depending on a criterion of maximization fitness function. Finally, the standard measure peak signal-to-noise ratio (PSNR), Structural Similarity, absolute square error and mean square error have been used to test the performance of suggested filters (original and improved median filter) used to removed noise from images. It achieves the simulation based on MATLAB R2019b and the results present that the improved median filter with crow optimization algorithm is more effective than the original median filter algorithm and some recently methods; they show that the suggested process is robust to reduce the error problem and remove noise because of a candidate of the median filter; the results will show by the minimized mean square error to equal or less than (1.38), absolute error to equal or less than (0.22) ,Structural Similarity (SSIM) to equal (0.9856) and getting PSNR more than (46 dB). Thus, the percentage of improvement in work is (25%).


Introduction:
Due to errors in noisy signals and channels of communication, images are often distorted by impulse noise. The resulting image processes such as edge-preserving, image segmentation, and object detection may be poor if the input image involves noise. It is therefore an important issue in image processing to detect noise pixels and then replace them with acceptable (1).
Impulse noise distribution can typically be divided into two types, fixed-value, and randomvalue types. A noise pixel takes either a max value of 255 or min value of 0 in impulse noise with a fixed value. The salt and pepper noise is also another name of impulse noise. The noise magnitude is uniformly distributed in the range [0,255] in salt and peppers noise. The papers suggested the salt and peppers noise filters aimed solely at the impulse noise of fixed pixel. The above filters outweigh any other impulse noise filters regardless of whether they are for salt and peppers noise value or many noises. Hence, this paper emphasizes only on the random value salt and pepper noise (2).
For a noise-corrupted image, linear or nonlinear filter algorithm may be used to remove noise. The details are high-frequency picture features in the frequency domain, which can easily be confused with high-frequency noises. Hence, the key to image filtering processing is how to keep the image information and remove random noises. The median filter is a nonlinear filter and is widely used in digital image processing for its good edgepreserving features and decreased impulse noise capability. The median filter is a class order filter. It's removing noise effects are based on the size and shape of the filter mask and the difficulty of its techniques vary based mainly on how the median pixel prevails. Further, to improve the removingnoise performance of the median filter, scholars have suggested several changed methods for the 615 conventional median filter. To increase the scanning velocity of the median pixel, several rapid strategies are suggested which are centered on the splittingconquering technique and simplified the complexities of the conventional median filter compare (3). For restoring images contaminated with salt and pepper noise, multiple non-linear filters were suggested. Some of them require iterative filtering processes for many pulses filtering techniques, such as (4). The escape method involves repeating several times the same process based on an impulse noise size detection. And effective window sizes have also been tested for various percentages of impulsive noises (5).
For higher density impulsive noise detection, Vijaykumar et al. suggested a method (6) using a robust 17X17 variable window estimate. A new strategy to adaptive median filtering of images was developed which uses small-size mask iterative image processing and post-processing of median filter result (7).
Erkan et al. (8) introduced the findings in distinct images, showing that the approach suggested by the DAMF is good and better compared with other methodologies. Many successful methods of color image denotation were built based on quaternion representation (9). An image enhancement element is projected in (10) in a modified cascaded filter for restore color, highly polluted by impulsive noise, and randomly valued pulsation noise.
The optimization is to find a solution in engineering problems that can reduce or optimize a cost function. The stochastic approach is more widely used today to solve the problem of optimization. The nature-inspired algorithm has recently proved the ability to solve more numerical optimization problems. It improves such methods of optimizing to solve complex problems such as flow shop planning, high-dimensional task optimization, accuracy, image processing, evolutionary computing, computer engineering, and other technical issues. Several other algorithms, such as Artificial Bee Colony (ABC), Ant Colony Optimization (ACO), Particle Swarm Optimization (PSO), Harmony Search (HS) and Crow Optimization Algorithm (COA) have used recently (11).
Crow Optimization Algorithm is a new natural inspired algorithm proposed by Askarzadeh in 2016 (12) based on the intelligent behavior that crows exhibit. In CSA, the population emulates a flock of crows which behave based on the thievery behaviors of crows. For global optimization, CSA is a simple and important alternative. It has only a few criteria to set for having an excellent result compared to similar approaches.
Based on research on prophase, this paper suggested two modifications to the median filtering technique based on the crow optimization algorithm: (1) To optimize noise reduction efficiency, the mask can be adaptive by a fitness function.
(2) Depending to the median filter crow optimization principle, it is only important to quickly find the median optimum value of the filtering mask and not to rank all mask pixels. The crow optimization algorithm is therefore used in the search process to speed up the search process with the optimal median value.
The remainder of the article is structured accordingly: Section II describes the median filtering algorithm works Section III offers the proposed optimum median filter. The simulation experiment and performance estimation of our experiment are explained in section IV. Section V eventually draws our conclusions.

Median Filtering Algorithms
The median filter is a statistical-based, signal processing of nonlinear technology. The digital image or sequence's noisy value is replaced by median value of mask. The components of the mask are numbered in the gray's sequence scales, and the med pixel of the mask is stocked to substitute the pixel of noise (13).
The output of a median filter is ( . )= med { S(i,j), i,j ∈ W }, at which y1(i,j) is the noisy image, W is the 2-mask dimensionally : the length of mask is Q × Q (at which Q is odd) like 3 × 3, 5 × 5, 7 ×7, etc; the form of median mask can be rectangular, circle, square, loop, etc..

Median Scaled Filter
For a window mask, the output of a median scaled filter (MSF) is defined as W = { S 1 , S 2 , S 3 , ..., S Q } where Q is the window length and is always odd. 1, 2,3,....., ( ) i j Q i j  Use MSF, the window's main pixel is changed with a value that minimizes the sum of the distances to all the other values in the odd-window (14).

Median Vector Filter:
Median vector filter (MVF) is a nonlinear ), ( i =1, 2, 3, …, Q) shows a component vector in the window. Next, determine the ranges of the vectors (L1 norm or L2 norm) in the window from each pixel to others. The sum of the lengths of the vector can then be estimated as (14): the norm for each (i,j) and ‖:‖  indicates of the norm. The filter used D 2 norm of Euclidian distance. At last, find the lowest of all the pixels (13). By sort configuration is S 1 S 2 , S 3 , ... ,S Q and the associated value vector is P 1 , P 2 , ... ,P Q . The above description can be provided by:

Adaptive Median Filter
The adaptive median filter (AMF), using an adaptively changed window length distinguish noise pixels, relieves the contradiction; however, the noise pixels also allow sort pixels in the window while filtering (5).
The adaptive median filter (AMF) can be used in noise detections for salt and pepper noise and substitute each y(i, j) with a pixel median on a specific window and confirm that most of the noise is detectable even at a high noise level given that the window is sufficiently large. Let S(i, j) be a W×W window pixel with a focus on (i,j), and allow W-max (Q) be the maximum window. Initialize W=3 and compute ( , ) min , ( , ) med , ( , ) max which denote the minimum, median, and maximum of the pixel values in ( , ), respectively. When ( , ) med ∈ ( ( , ) min , ( , ) max ), impulse noise does not dominate the window, so , is not a noise candidate if (i,j) ∈ ( ( , ) min , ( , ) max ), else (i,j) is replaced by ( , ) med (Median Filtering); When ( , ) med ∉ ( ( , ) min , ( , ) max ), impulse noise dominates this window, then set w = w+2 (Adaptive) and repeat the above steps. When w ≥ w-max, (i,j) is replaced by ( , ) med (the algorithm is terminated when the maximum window size is reached). Notice that except for the noise candidates that are replaced by the median ( ,) med , the remaining pixels are left unchanged (15).

Proposed Optimum Median Filter The Noise-Reducing
Since the median filter is a statistical-based, its mathematical model is relatively complex for the random noise image. The noise variance of the median filtering is approximately of zero noise average under standard deviation for an image: Where 2 i  is the standard deviation noise, the mask length of filter is Q, 2 () fQ is the noise distribution variable. And the average filtering of variance noise is: From equation (5) and equation (6), the results of the median filter are based on two principles: the length of mask and the noise distribution. The median processing efficiency of noise cancellation is better than mean filtering operation, but to the salt and pepper noise, particularly broad pulses are more distant and the length of signal is smaller than Q/2; the median filter is very efficient. The output of the median filter must be enhanced if the median filtering object recognition can be modified to the noise density of the mask besides the mean filtering process. A developed median filtering technique was proposed on the basis of this work (3).

Crow Optimization Algorithms
Crow search algorithm (CSA) is a modern meta-heuristic technique suggested by Alireza (12) to solve problems of optimization. It is motivated by crow's cleverness in seeking sources of food. The CSA is made up of three sequential stages. First, each crow's hiding place location is generated randomly and each crow F's memory is initialized as the best experience with this location. Second, according to the fitness function, crow determines the value of its location. Eventually, crow randomly populates and leads one of the flock crows to determine the location of the foods that this crow hides. If the location of the food is good, the crow can change its location. Otherwise, the crow will remain in the current location and will not switch to  Step 2: Each crow is tested based on its location quality, which has been assigned to the fitness function required.
Step 3: Crows generate new locations in the search space: Crow i randomly assign one of the bird crows, i.e. crow k, and then discovers the crow safe food location where the new crow i location at next iteration (T+1) is created by:

Optimum Median Filter Based on Optimization Algorithms
The algorithm's complexity is determined primarily by measuring the median filtering value; the article presents the crow optimization algorithm to increase probability of finding the median value by replacing it with an optimal median value based on the fitness function. The method provides the following steps: Step8: for each epoch .
Step9: Randomly generate a crow position c(i,j).
Step 11: compute s min , s med and s max , in s(i,j).
Step 12: if s min < s med < s max , then go to step 13.

Otherwise, set W= W+2 until the W-max (Q) is reached.
Step 13: if W ≤ W-max(Q), go to step 11. Otherwise, choose pixels in the window such that s min < s(i,j) < s max and go to step 15.
Step 14: if s min < y(i,j) < s max , then ̃ (i,j)= y (i,j), else choose pixels in the window such that ̃ (i,j)= s med (i,j)+c(i,j) and go to step 15.
Step 15: evaluate of maximization fitness function (peak signal to noise ratio (PSNR)).
Step 16: memory initialization and fitness of memory position.
Step 17: generation of random candidate crows for chasing. Step 18: a new solution is evaluated by the fitness function.
Step 19: update position and memory.
Step 20: best found value is used as optimum weight and medium value to reach for optimum filter.
The visual influence of the subjective or the method of estimating the purpose may estimate the effect of the image noise reduction. The work takes the mean absolute error (MAE), Peak Signal-to-Noise Ratio (PSNR) and the mean square error (MSE) between the filtered image ̃ (i,j) with the rows and columns is N × R and the original image y(i,j) with the rows and columns is N × R, at which i=1,2,3,….. N and j=1,2,3,…. R. The definition of PSNR, MAE, and MSE are at equations (10), (11) and (12), respectively (4), SSIM at equation (13). ( , y) = (2 ỹ+ 1 )(2 ỹ+ 2 ) (μ 2 + ỹ2 + 1 )( 2 + y2 + 2 ) (13) Where and ỹ represent the mean of the original and restored images. 2 and y2 represent the standard deviation of the original and restored images. ỹn d restored image. S1 and S2 represent small constant are added to avoid instability (7). Tables 1-4 (32) and Adaptive Median Filter (AMF) (5), in terms of Structural similarity index (SSIM), PSNR, AE, MSE for the test image corrupted by 10%, 20%, 30%, 40%, 50%, 60%, 70% and 80% noise density, espectively.This work test how the improved median filter is better than standard filtering technique and other works comparisons, based on an optimizing approach. The enhanced method has major advantages, especially with high peak-signal-to-noise parameter, high structural similarity metric, and low absolute error. These results show that it works with a very high probability of impulse noise efficiently and that the proposed algorithm provides higher subjective quality in terms of impulse noise elimination and image information preservation.By summarizing and analyzing the numerical results listed in Tables 1-4, some conclusions can be drawn. In the SMF, the value of PNSR and SSIM is smaller, for example, in Table 1 (Lena image); the value of PNSR is 36.61 and 91% respectively under 20% impulse noise. The value of MAE and MSE is larger; it is 1.83 and 14.21 respectively under 20% impulse noise. It blurs image details severely. OMF has a better performance than the classical solutions at low noise density. For example, in Table 1, the value of PNSR is 35.59 and 80% respectively up to 50% impulse noise. The value of AE and MSE is larger; it is 2.44 and 17.96 respectively up to 50% impulse noise. When the density of impulse noise is increased, OMF has best performance under lower noise or higher noise.   DBMF [19] ATMF [20] AVMF [21] ACWVMF [22] ARWSF [23] QSF [25] Open

PSNR Noise Density
Retinal_artery_occlusion-image SMF [18] AVMF [21] LPG [29] ARWSF [23] SVMF [30] QSVF [31] TSQVMF [32] OMF(Proposed)  the capability of improved the suggested process which has an optimum median value of mask. The modified architecture increase the computational time required for finding the median, but this increases the efficiency of the system with minimum error. The algorithm removes noise even at higher noise densities (up to 50%) and preserves the edges and fine details. The performance of the algorithm is better when compared to the other architecture of this type because the optimum median filter has a capability to find optimum candidate median value with less complexity process and high structural similarity index (up to 95%) for color images and (up to 97%) for gray image with percentage of improvement (25%).