## 3 Image Acquisition and Distortion Correction
### Axial Distortion Correction  
The purpose of axial correction is to ensure that all calibration blocks have the same height. This is achieved by fitting a function \(\delta=G(r)\) based on the n-axis coordinates of the mass center of the calibration block and the known axial distance in the hole and then non-linearly stretching the image according to this function. When fitting, either the maximum radius \(r_{\text{max}}\) of the image at the minimum depth of field or the bottom circle \(r_{\text{min}}\) at the maximum depth of field can be selected as a benchmark for intercepting the image.  
When selecting \(r_{\text{max}}\) as the reference, it is necessary to determine the minimum depth of field of the endoscope \(H_{0}=R\cdot\text{cot}(\alpha/2)\) using the lens wide angle \(\alpha\) and aperture \(R\), as shown in Figure 3a. If \(r_{\text{min}}\) is used as the reference, the distance between the bottom end of the hole part and the lens must be known. In this paper, since we know the height of hole parts, calibration results are presented in Figure 9. Where the \(X\)-axis represents the distance \(r\) from the pixel to the image center (in pixel), and the \(Y\)-axis represents the height (in mm) of the inner surface of each pixel at the centroid position of the calibration block. The fitting result is \(\delta(r)=13.65/(r-107.2)\) with goodness-of-fit R\({}^{2}\) = 0.968 and RMSE = 0.0046, which indicates satisfactory results.  
Based on the fitting results, nonlinear stretching was performed in the vertical direction (N-axis) of Figure 6, and the outcomes are presented in Figure 10.  
By observing Figure 10, it can be seen that the height of each calibration block remains consistent after circumferential correction. The pixel height of all calibration blocks was calculated and found to have a mean value of 13.02 pixels with a standard deviation of 1.25, indicating an ideal correction effect. After correction, each pixel represents an actual circumferential arc length of \(j\) = 0.1152 mm/pixel. The mean and standard deviation were calculated in behavioral units and are shown in Table 2.  
\begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline  & & & & & & & & & & \\ \cline{3-10}  & & **1** & **2** & **3** & **4** & **5** & **6** & **Mean Value** & **Standard Deviation** \\ \hline \multirow{6}{*}{Row Number} & 1 & 138 & 139 & 137 & 132 & 130 & 122 & 133.00 & 6.450 \\  & 2 & 116 & 119 & 119 & 116 & 112 & 109 & 115.20 & 3.971 \\  & 3 & 100 & 102 & 100 & 99 & 97 & 92 & 98.33 & 3.502 \\  & 4 & 83 & 85 & 86 & 84 & 84 & 81 & 83.83 & 1.722 \\  & 5 & 71 & 72 & 72 & 72 & 70 & 67 & 70.67 & 1.966 \\  & 6 & 56 & 58 & 59 & 60 & 60 & 59 & 58.67 & 1.506 \\  & 7 & 46 & 47 & 49 & 50 & 49 & 47 & 48.00 & 1.549 \\  & 8 & 34 & 35 & 36 & 38 & 39 & 39 & 36.83 & 2.137 \\  & 9 & 24 & 26 & 28 & 30 & 31 & 30 & 28.17 & 2.714 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Calibration block centroid coordinate statistics (N axis)/pixel.  
Table 2 shows that the maximum standard deviation is only 1.169, and the average of the nine standard deviations is 0.95, indicating good consistency in representing axial distance with pixels of the same height in the hole. By calculating the deviation between the row mean and the total mean, it was found that there are certain inter-group differences as indicated by a distribution range of approximately 20%. The main reason is that the fitting data for \(\delta=G(r)\) comes from the axial correction results, and there are inevitable errors in the process of detecting the image center.