## 2 Image Preprocessing
### Adaptive Step Size  
For the method of complementary front and back chord inclination angles of the contour, the step size (\(t\)) determines the sensitivity of the chord inclination angle to changes in the jagged contour distribution. A smaller value of \(t\) leads to a lower sensitivity of the chord inclination angle, which results in a larger deviation in the detection position of the tangent point or leak detection. As can be seen in Figure 10 for the tangent of the large arc in the pending inspection image, a larger value of \(t\) leads to a higher sensitivity of the chord inclination angle, which results in all the shorter graphic elements in the contour being considered as segmentation points, making it more difficult to differentiate them, as shown in Figure 11 for the segmentation points between shorter graphic elements: e, f, and g.  
In summary, in the initial screening of the segmentation points by the chord inclination angle, the crossover points of graphic elements could be detected using a short step size, but the tangent points and inflection points could not be detected. In this case, fewer segmentation points were obtained, and the operation cost of the subsequent algorithm was low. Using a long step size, all segmentation points could be detected. In this case, the number of segmentation points was too large, and the operation cost of the subsequent algorithm was too large.  
The goal of the adaptive step size design is to obtain an accurate and complete segmentation point detection ability while costing less and increasing the adaptive ability of the algorithm.  
When the chord inclination angle is complementary to obtain the segmentation points, if the pixel length (s) is taken as the step length, there are 1\(\sim\)s pixel segmentation points at the crossover points of primitives. When the step size is shorter, there is only one isolated  
Figure 11: All shorter graphic elements being considered as segmentation points.  
Figure 10: Deviation in the positions of the segmentation points at the tangent point of the great circle.  
segmentation point at the tangent point and the inflection point. Therefore, the adaptive step size is detection using a shorter step and then using a longer step near the isolated segmentation point.  
In this way, the value of a short step size only determines the operation cost of the algorithm but does not affect its detection performance. Therefore, the minimum value of the short step size was set to two pixels.  
The contour intercepted by the nearest segmentation points to the left and right of the isolated segmentation point were detected using a longer step size, and the number of contour points between the isolated segmentation point and the nearest segmentation points to the left and right were recorded as _len1_ and _len2_, respectively. The larger step length should not be greater than min(_len1_, _len2_). If max(_len1_, _len2_)>>min(_len1_, _len2_), the expected segmentation points tended to be on the longer side, and to make sure they were properly positioned, we needed to set the step size to min(_len1_, _len2_). Based on the above description, we temporarily set the longer step size to min(min(_len1_, _len2_), max(_len1_, _len2_)/50). To avoid the calculated value of the longer step being too small to be used, the longer step was defined using Equation (13).  
\[\centering Stepsize=\max(10,\min(\min(len1,len2),\max(len1,len2)/50))\@add@centering \tag{13}\]  
The use of adaptive steps can effectively avoid all the shorter tuples being considered as segmentation points and solve the bias of tangent point position detection. These effects are presented in Figures 12 and 13.