# Genetic Programming to Remove Impulse Noise in Color Images
## 3 Preliminaries: Color Image Denoising
### Image Quality Metrics  
In this work, the following metrics are used to objectively measure the quality of the output images after the filtering process: the peak signal-to-noise ratio (PSNR), mean absolute error (MAE), structural similarity index measure (SSIM), and feature similarity index measure (FSIM). These metrics provide quantitative values of how close or far a filtered image \(I_{\text{F}}\) is from its original reference image \(I_{\text{O}}\).  
The PSNR and MAE are the most widely used and straightforward full-reference quality metrics. The advantages of these metrics are that they are simple to calculate, transparent in physical meaning, and independent of visual conditions. The PSNR measures the effectiveness of a filter in removing noise, whereas the MAE evaluates the performance of a filter in preserving the details of an image. The PSNR measure is defined via the mean-square error (MSE) as follows:  
\[\text{PSNR}=20\log_{10}\biggl{(}\frac{255}{\sqrt{\text{MSE}}}\biggr{)}, \tag{1}\]  
\[\text{MSE}=\frac{1}{3N}\sum_{i=1}^{N}\sum_{q=1}^{3}(I_{\text{O}}(x_{i}^{q})-I _{\text{F}}(x_{i}^{q}))^{2}. \tag{2}\]  
The MAE measure is expressed in the following form:  
\[\text{MAE}=\frac{1}{3N}\sum_{i=1}^{N}\sum_{q=1}^{3}\Bigl{|}I_{\text{O}}(x_{i} ^{q})-I_{\text{F}}(x_{i}^{q})\Bigr{|}. \tag{3}\]  
Note that a high PSNR value means a higher amount of noise removed from the image. Conversely, a low MAE value means fewer lost details in the image. The computational complexity of these two metrics is \(O(N)\) for any color image \(I\).  
On the other hand, the SSIM and FSIM are metrics that compute the similarity between restored and original images based on human visual perception. The SSIM compares local patterns of pixel intensities normalized for luminance and contrast, whereas the FSIMmakes the comparison based on two low-level features: phase congruency and gradient magnitude. The SSIM is defined as  
\[\text{SSIM}(I_{O},I_{F})=\frac{2\mu_{I_{O}}\mu_{I_{F}}+C_{1}}{\mu_{I_{O}}^{2}+\mu_ {I_{F}}^{2}+C_{1}}\cdot\frac{2\sigma_{I_{O}}\sigma_{I_{F}}+C_{2}}{\sigma_{I_{O} }^{2}+\sigma_{I_{F}}^{2}+C_{2}}\cdot\frac{\sigma_{I_{O}I_{F}}+C_{3}}{\sigma_{I _{O}}\sigma_{I_{F}}+C_{3}}, \tag{4}\]  
where the first term signifies the luminance comparison function, assessing the proximity of the mean luminance in both images (\(\mu_{I_{O}}\) and \(\mu_{I_{F}}\)). The second term represents the contrast comparison function, gauging the similarity in contrast between the two images, as measured by their standard deviations (\(\sigma_{I_{O}}\) and \(\sigma_{I_{F}}\)). The third term indicates the structure comparison function, quantifying the correlation coefficient between the images \(I_{O}\) and \(I_{F}\). The positive constants \(C_{1}\), \(C_{2}\), and \(C_{3}\) are introduced to prevent division by zero.  
On the other hand, the FSIM is defined as  
\[\text{FSIM}(I_{O},I_{F})=\frac{1}{N}\sum_{x,y}F(I_{O}(x,y),I_{F}(x,y)), \tag{5}\]  
where \(F(I_{O}(x,y),I_{F}(x,y))\) is a function that measures the similarity between the corresponding pixel values \((x,y)\) in the two images. This function typically takes into account the luminance, contrast, and structure comparisons. The formulation and mathematical details of the SSIM and FSIM can be found in [43] and [44], respectively. Unlike the PSNR and MAE metrics, the SSIM and FSIM are normalized between 0 and 1, with 1 being the best possible result. However, the SSIM and FSIM have a higher computational complexity compared to the PSNR and MAE.