# Image Reconstruction Using Autofocus in Single-Lens System
## 3 Simulation and Experiments
### Autofocus for Object Distance  
When only the object distance, \(z_{1}\) in Figure 1, is unknown. The positive effect of the diffuser on estimating the distance value will be checked in the simulation. The search boundary of \(z_{1}\) is 10 mm\(\sim\)60 mm. To compare the results of CEFs in both coherent and speckle illumination, all evaluation results are normalized. The CEF curves are shown in Figure 7. Binary sample and grayscale sample used here correspond to Figures 4 and 6a, respectively. The curves in Figure 7a1,a2,b1,b2 denote the results with the coherent illumination and the curves in the Figure 7c1,c2,d1,d2 are for the speckle illumination. For the binary sample, it is obvious that the speckle illumination is helpful for a stable and robust searching focus for all CEFs except GRA. The original correct result of GRA under coherent illumination is destroyed. The sensitivity of the curves is significantly improved. For the grayscale sample, the autofocus curves of the two illumination modes show good unimodality and high sensitivity, except for TOG. The curve performance of GRA, Entropy, and AM has been improved. However, the originally good TOG curve was destroyed. In summary, a diffuser is more conducive to accurately estimating the diffraction distance by CEFs. Speckle illumination is helpful for a unique and robust auto-focusing search even using the simple metric function in the single-lens CDI system. The experimental verification is made by using the experimental device shown in Figure 8. A fiber laser (532 nm) is collimated by a lens (f = 200 mm). A diffuser (DG10-120-MD, Thorlabs, 120 grit) serves as a scattering medium. The focal length of lens L\({}_{2}\) is 35 mm. A CCD (3.1 \(\upmu\)m) is moved by a precision linear stage. In the experiment, the sample is a calibration target engraved with '78'. The number of measured patterns is 11 and the interval is 1 mm. Figure 9a-d show the reconstructed results of SCIE and PCIE for the two illumination modes, respectively. Using diffraction patterns, the reconstructed results of PCIE are significantly better than that of SCIE. Even though the reconstructed image in Figure 9c has the twin-image effect and some noise around digits, Figure 9a shows the result of unsuccessful reconstruction after 1000 iterations. For the reconstructed results by using speckle patterns, the reconstructed results of PCIE and SCIE  
Figure 7: The performance of autofocus by coherent illumination and speckle illumination, respectively: (**a1,a2,b1,b2**) show the CEF curves of binary and grayscale sample respectively by using diffraction patterns; (**c1,c2,d1,d2**) show the CEF curves of binary and grayscale sample respectively by using speckle patterns. can both distinguish the number '78', in Figure 9b,d, respectively. The reconstructed result of SCIE has higher contrast visually. Figure 9c1-c4,d1-d4 show the CEF curves for coherent and speckle illumination, respectively. Speckle illumination optimizes the large fluctuating CEF curves under coherent illumination. We cropped the information-rich area in the reconstructed image data set corresponding to the yellow box in Figure 9c,d. The clarity of this area is evaluated, and the corresponding CEF curves are shown in Figure 9c3,c4,d3,d4. When evaluating the clarity of the rich-information area of the image, speckle illumination still shows superiority. Therefore, speckle illumination plays a positive role in single-lens CDI object distance scanning, which not only makes the SQF curve unimodal but also improves the accuracy of the auto-focusing results. The diffuser provides random illumination for the imaging system, which will disorganize the tilt phase factor and counteract the lateral shift effect of intensity pattern. This property is called the memory effect of speckle [39; 40]. The speckle pattern is inherently random, so oblique illumination will not affect it. Furthermore, speckle illumination can eliminate the aliasing artifact and enhance the robustness [32]. Figure 8: The schematic diagram of the CDI setup.