## 2 Image Preprocessing
### Bicubic Interpolation Process  
The bicubic interpolation algorithm employed the grayscale values of 16 points around the sampled point as three interpolations, which took into account not only the grayscale \begin{table}
\begin{tabular}{c c} \hline \hline
**Type of Relationship** & **Content** \\ \hline Equal length & \(l_{4}=l_{7}=l_{10}/2\), \(l_{14}=l_{13}\), \(l_{5}=l_{6}\) \\ Parallel & \(l_{4}//l_{10}\), \(l_{7}//l_{2}//l_{13}\) \\ Equal radius & \(R_{l_{3}}=R_{l_{8}}=R_{l_{9}}=R_{l_{11}}=R_{l_{12}}/2=R_{l_{1}}/4\) \\ Other relationships & \(\angle l_{13}l_{14}=165^{\circ}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Relationships between the graphic elements. Figure 4: Pending inspection image in this paper. The value of the interpolated pixel was obtained by dividing the sum of the products of each pixel and the weights by the sum of the weights, as in Equation (10). \[I^{\prime}\big{(}x^{\prime},y^{\prime}\big{)}=\sum_{j=1}^{4}\sum_{i=1}^{4}\big{(} I(x+i-1,y+j-2)\cdot h(d_{x_{i}})\cdot h\big{(}d_{y_{i}}\big{)}\big{)} \tag{10}\]  
Bicubic interpolation was adopted to expand the length and width of the grayscale image of the original flat part to twice the size of the original image so that the graphic element of the part had more contour points as support. **3. Detection Algorithm Design of Segmentation Points of Graphic Elements**  
_3.1. Obtaining the Initial Screening Segmentation Points_  
When acquiring single-pixel contours from a part image, the part contours need to be distributed in a pixel-based grid, which inevitably causes jagged boundary contours (Figure 6). The impact of the jagged contour on segmentation point detection is mainly attributed to two aspects: on one hand, the jagged contour causes noise-like effects that lead to the formation of pseudo-segmentation points; on the other hand, some local features of contour serrations are stronger than the segmentation points of the pending inspection [31], thus resulting in missed segmentation point detection. Some methods have been studied and reported for the above situations. For instance, [PERSON] et al. [26] adopted Gaussian functions to smoothen the contour, resulting in an increase in the support area of the detection operator [13]; however, smoothing the contour causes leak detection of segmentation points with insignificant local features as well as spatial location changes of the segmentation points, and the smoothing treatment is irreversible. In addition, increasing the support area of the detection operator also leads to the leak detection of segmentation points that are closer. Therefore, in this paper, we proposed a method to remove the effect of a jagged contour using the complementary front and back chord inclination angles of the contour point. For a point (\(P_{i}\)) on the contour, the front and back chord inclination angles are shown in Figure 7.  
Figure 6: Contour jaggedness error. (**a**) Ideal boundary contour; (**b**) True boundary contour. The front chord inclination angle (the angle between the green arrow and the red arrow) was calculated using Equation (11). \[\theta_{i^{+}}=\arctan\left(\frac{\left|P_{i+t}^{\rightarrow}P_{i}\right.\times P _{0}^{\rightarrow}\right|}{\left|P_{i+t}^{\rightarrow}P_{i}\right.\cdot\cdot P _{0}^{\rightarrow}\right|} \tag{11}\]  
The back chord inclination angle (the angle between the blue arrow and the red arrow) was calculated using Equation (12). \[\theta_{i^{-}}=\arctan\left(\frac{\left|P_{i}\overrightarrow{P_{i-t}}\right. \times P_{0}^{\rightarrow}\right|}{\left|P_{i}\overrightarrow{P_{i-t}} \right.\cdot\overrightarrow{P_{0}}\right|} \tag{12}\]  
where \(P_{0}=(0,1)\) is the unit horizontal vector and \(t\) is the length of the chord across the contour point.