# Data-Driven Convolutional Model for Digital Color Image Demosaicing
## 4 Results  
In this section we compare our demosaicing algorithm to a selection of classical algorithms [14; 24; 25] and more recently developed techniques [7; 20]. Among the large number of published work on demosaicing, we selected the ones that provide algorithm implementation or performance results. No general agreement exists on the kind of error function to be used when comparing the performance of demosaicing algorithms since perceived visual similarity between images is highly subjective. Nevertheless, different error functions have been defined to approximate the similarity between images as close as possible to human perception. Distance-based functions have simple mathematical formulation and allow for a formal definition similarity between images, however they are often unable to discriminate images that contain visual artifacts. Examples of distance-based functions include Mean Squared Error, Mean Absolute Error, and Peak Signal-to-Noise Ratio (PSNR). Distance-based functions can provide good approximation of the human perceived difference between two images if the image is first converted from RGB to CIE-lab color space. In CIE-lab color space, visually similar colors are also geometrically closer, thus chromatic differences between images can be compared. Specific quality functions such as the Structural Similarity Index (SSIM) can be used if better approximation of perceptual difference is required. Other functions specific for demosaicing are the blurring measurement, zipper effect measurement, false color measurement, subdetected/overdetected edges and shifted edges [8]. In this work we compared the performance of our algorithm using the MSE error function defined in CIE-lab color space, the PSNR function and the SSIM function. We computed the MSE in CIE-lab space using the formula in Equation (9). \[MSE(I_{rgb},I_{est})=\frac{1}{3 WH}\Big{\|}rgb2 lab(I_{rgb})-rgb2 lab(I_{est}) \Big{\|} \tag{9}\]  
where \(I_{rgb}\) is the original RGB image, \(I_{est}\) is the reconstructed image from the Bayer image, \(\|\cdot\|\) is the euclidean norm, \(rgb2 lab(\cdot)\) is the color space conversion function between RGB and CIE-lab, \(W\) and \(H\) are the image width and image height. The PSNR function is defined in Equation (10). \[PSNR(I_{rgb},I_{est})=10 log_{10}\Bigg{(}\frac{max(I_{rgb})^{2}}{mse(I_{rgb},I_{est})}\Bigg{)} \tag{10}\]  
where \(I_{rgb}\) is the original RGB image, \(I_{est}\) is the reconstructed image from the Bayer image, and \(mse(\cdot)\) is the Mean Squared Error function. For the computation of the SSIM function we used its original definition, as provided in [26]. Figure 10: Structure of the Full Reconstruction Network. Input image is preprocessed by converting the Bayer CFA image to a zero-filled RGB image. The preprocessed image is fed to the Luminance Reconstruction Network and the Chrominance Reconstruction Network. The Luminance Reconstruction Network produces a single channel image, the Chrominance Reconstruction Network, a three-channel image. Both outputs are merged in the final output RGB image. Similarly to other works in the literature [7; 19; 27], we used the Kodak dataset [6] as the benchmark dataset. The Kodak dataset is composed of 25 uncompressed PNG true color images of size 768 \(\times\) 512 pixels. For testing the performance of different demosaicing algorithms, the dataset is usually divided into a training set of 10 images and a test set of 10 images. Images are subsampled using the Bayer pattern configuration and used as input to the demosaicing algorithm. The original RGB images are then compared to the demosaicing output using one of the previously described error functions [17; 20; 21]. In this work we follow the same overall procedure in order to compare as closely as possible our solution to existing algorithms. We note however that previous works do not report the registered quality metrics.