# First Earth-Imaging CubeSat with Harmonic Diffractive Lens
## 4 Image Reconstruction
### Deep-Learning-Based Reconstruction  
In this section, we describe an end-to-end deep-learning convolutional neural network based image reconstruction based on our work [12] where we showed that a lossy compression of a video stream captured with a harmonic diffractive lens leads to reconstruction artifacts. Training two different CNN models for lossless and lossy video streams was proposed as a solution. We used both models in this paper. The images captured in space and the models we used for their reconstruction were published online in our GitHub [52].  
To test the imaging and reconstruction quality, indoor images were captured with the Basler acA1920-40 uc camera equipped with an HDL identical to its spaceborne counterpart, allowing us to evaluate the ground truth visual quality. Figure 7 shows one image captured indoors (left, Figure 7a) and its CNN-based image reconstruction (right, Figure 7b). As shown in Figure 7b, the reconstructed image provides good visual quality by restoring image details, making the text readable. It is important to note that the presence of high-frequency details, such as text, allowed us to accurately evaluate the image reconstruction quality.  
The image captured with the Basler daA1600-60 uc (USB 2.0) with a gain level of 4 is shown in Figure 8a. This high level of gain produces significant imaging noise, as shown in Figure 8a and in Figure 8b with a color-normalized image.  
Figure 7: (**a**) Comparing a CNN-based reconstruction to the deconvolution: (**a**) an unprocessed image taken with our lens indoors; (**b**) an image reconstruction with a CNN; (**c**) an image reconstruction with deconvolution; (**d**) ground truth image captured with a conventional lens.  
Neural networks were trained for lossless and lossy video stream reconstruction, as described in [53]. Figure 8c,d show the result of the CNN reconstruction by the lossless and lossy models, respectively. The image produced by the lossless model has strong artifacts compared with the lossy model output. We can observe that the lossless model result has strong artifacts only in the dark part of the image (in the water part), mostly due to the noise of the input image which is a result of the camera CMOS sensor noise.  
To deal with the camera sensor noise, we applied a denoising algorithm in the dark areas of the input image to compensate for the reconstruction artifacts. An optimal denoising result was achieved by the algorithm from [53] with the regularization parameter of 0.2 and iteration count of 1200. We obtained the segmentation mask using a threshold processing algorithm to apply the denoising algorithm to the dark part of the input image (water) as shown in Figure 8a. The lossy CNN model was then applied to the denoised  
Figure 8: Comparing the performance of different CNN models: (**a**) an unprocessed image captured with an HDL by the nanosatellite; (**b**) an image with color normalization applied; (**c**) the lossless model processing result; (**d**) the lossy model processing result.  
image, with the result shown in Figure 9. One may see a higher quality of the water area as the artifacts became less noticeable. More examples of the reconstructed images captured with our HDL in the nanosatellite are shown in Figure A3 in Appendix A.  
While the indoor test results were promising, the satellite images need extra denoising applied before a CNN-based reconstruction is performed. In Appendix A, we study the impact of the gain level and the dynamic range of captured images on the CNN-based reconstruction results. The results we obtained highlight the importance of a low gain value for image quality. Our study determined that the highest gain value for the onboard camera that did not lead to artifacts in reconstructed images is 3. Image reconstruction artifacts caused by the dynamic range of the captured image can be treated as adversarial attacks [54], similar to the way it was done for lossy compression before [12].