## 2 Materials and Methods
### Depth of Focus 3D Reconstruction  
Depth of focus (DOF) and depth of field (DOF) refer to the image space depth and object space depth, respectively, when the target object is imaged clearly. Due to the depth of the field limitation of the lens, the captured image generally has some areas that are clear and some areas that are blurred. However, with the application of technologies such as auto-focusing (AF) and high dynamic range imaging (HDR), the all-in-focus image of the scene can be obtained. By passing each section of the object through the depth of field area of the camera, a sequence of defocused images with different degrees of focus can be obtained. The focus evaluation function is then used to analyze the clarity of the defocused image sequence pixel by pixel, thereby restoring the three-dimensional morphology information of the target object. In actual application scenarios, the shallow depth of field lens imaging is often used to obtain a sequence of defocused images of each section, and the depth of field is closely related to the camera and lens parameters. \(\mathbf{P}_{1}\), \(\mathbf{P}_{2}\) and \(\mathbf{P}_{3}\) are three imaging object points, which are imaged on the image side \(\mathbf{Q}_{1}\), \(\mathbf{Q}_{2}\) and \(\mathbf{Q}_{3}\) through the lens, as shown in Figure 6a. According to the characteristic of \"point objects form point images\" of an ideal optical system, all points on the conjugate plane of the camera sensor plane in the object space can be focused and imaged, while the images formed by points on other planes far away from the conjugate plane of the sensor will form a confusion circle. When the radius of the confusion circle is so small that the human eye cannot distinguish it, the confusion circle at this time is called the acceptable circle of confusion, and the distance from the acceptable circle of confusion formed in front and behind the camera sensor to the sensor plane is called the front focal depth and the back focal depth. In an ideal thin lens imaging system, the object distance \(\mathbf{u}\), image distance \(\mathbf{v}\), and focal length \(\mathbf{f}\) satisfy the Gaussian lens formula  
\[\frac{1}{\mathbf{u}}+\frac{1}{\mathbf{v}}=\frac{1}{\mathbf{f}} \tag{17}\]  
where \(\mathbf{u}\) is the distance from the object to the lens (object distance, depth), \(\mathbf{v}\) is the distance from the lens to the imaging plane (image distance), and \(\mathbf{f}\) is the focal length of the lens. Figure 6: Principle of depth of field and 3D morphology reconstruction. (**a**) Schematic diagram of the correspondence between object points and image points under limited depth of field. The lens forms clear images only for object points located within the depth of the field range, while points outside this range appear blurred. Different colors represent different wavelengths, each with a distinct focal plane due to chromatic aberration. The displacement can then be estimated by analyzing the wavelengths of the reflected light. (**b**) Principle of 3D morphology reconstruction using multiple focal planes. By capturing a stack of defocused images at different focal depths, and analyzing their sharpness pixel by pixel, the complete 3D surface morphology of the object can be reconstructed. When the object is in focus, the image on the imaging plane is clearest; when the object deviates from the focus, the image will be blurred. If the imaging plane is not in focus, the telescope will image the point light source as a circle of confusion, whose diameter C is related to the depth deviation. The diameter of the confusion circle can be derived through geometric optics  
\[C=A\left|\frac{\mathbf{v}-\mathbf{v}_{f}}{\mathbf{v}_{f}}\right| \tag{18}\]  
where \(\mathbf{A}\) is the lens aperture diameter, \(\mathbf{v}_{f}\) is the image distance corresponding to the focal position, and \(\mathbf{v}\) is the image distance of the current imaging plane.