## 6 Conclusions  
In this paper, a method based on endoscopic imaging principles is proposed for distortion correction and measurement of in-hole images. The circumferential correction and axial correction are used to restore the endoscopic image to an orthographic image that conforms to the visual habit and enables accurate size measurements. The feasibility of the method is verified through experiments, and factors affecting detection accuracy are discussed. Specific conclusions include: (1) Image processing-based methods can effectively correct endoscopic image and achieve defect measurement the goals with high accuracy; the average deviation of three groups of measurement results is 5.35%, with absolute error less than 1 mm; (2) The measurement method is not affected by the aperture, and the accuracy is not influenced by the test object, making it highly applicable; (3) The image center offset has a direct impact on both image correction and measurement accuracy, especially in the vertical direction; (4) Both the fitting accuracy of the axial distance growth function and the outer diameter of the truncated circle affect correction errors and measurement accuracy. As the ring outer diameter increases, the measurement error gradually decreases while measurement accuracy improves.  
The correction and measurement method proposed in this paper aims to restore the internal surface defect morphology through image processing. Experiments have shown that the correction effect is ideal, and the overall accuracy is high. However, shooting errors can cause variations in the correction effect of images taken from different directions. To improve accuracy and reduce error, attention should be paid to the following aspects during shooting: (1) Ensuring that the main optical axis of the lens coincides with the hole axis by designing an endoscopic probe sleeve for this purpose; (2) The internal surface calibration substance should be added, and the calibration paper drum with hollow can be inserted into the hole in the industrial field application. Alternatively, a tubular structure with internal texture and a hollow area can be designed and installed in front of the probe sleeve; (3) It is necessary to adjust the endoscope probe so that inner surface defects are imaging within a small depth of field area, ensuring they are located at the edge of the vertical direction of the endoscopic image as much as possible.  
The image correction method proposed in this article has the potential to be extended to a variety of wide-angle lenses, including surveillance cameras and fish-eye lenses. It can also be applied for target object size estimation and measurement. Furthermore, the internal surface defect measurement method presented here offers a solution for measuring parts with holes or cavities, which can be utilized in machine vision-based quality inspection of hole inner surfaces.  
Conceptualization, P.S. and Q.S.; methodology, Z.T. and Q.S.; validation, P.L. and Q.S.; resources, P.S.; data curation, Z.T.; writing--original draft preparation, Z.T.; writing--review and editing, Q.S; visualization, P.S. and Z.T.; supervision, P.L.; funding acquisition, P.S. All authors have read and agreed to the published version of the manuscript.  
This research was funded by the Key R&D Plan of Shaanxi Province in the Agricultural Field, China. Grant number 2021 NY-129.  
Not applicable.  
The authors would like to thank the Editor-in-Chief for reading the manuscript and providing valuable comments. The authors would also like to thank the anonymous reviewers for their valuable comments and suggestions, which helped improve this paper greatly.