## 3 Image Processing of Weld Seams
### V-Shaped Weld Seam Feature Extraction Algorithm  
The geometry of V-shaped weld seams indicates that all feature points are intersections of line segments. Traditional feature extraction methods for V-shaped weld seams often utilize statistical approaches, randomly sampling all laser stripe center points to fit four line segments and determining their intersections [31]. These methods are not only time consuming but also lack accuracy. To address these shortcomings, this paper introduces a feature extraction algorithm for V-shaped weld seams that employs maximum distance search for initial extraction, followed by least-squares fitting for optimization. The principle behind using the maximum distance search method for preliminary feature point extraction is illustrated in Figure 7. The detailed procedure is as follows:  
Step 1: Starting with the points \(P_{\text{st}}\) and \(P_{\text{ed}}\) of the light stripe, form a line \(L_{1}\) through linear interpolation. Then, use Equation (18) to calculate the distance \(d_{pn}\) of all light stripe center points from the line \(L_{1}\). The point corresponding to the maximum distance \(d_{\text{max1}}\) is selected as the rough extraction point for the feature point \(P_{\text{v1}}\). \[\text{d}_{\text{p}}=\frac{\left|\text{k}_{\text{p}}\text{x}_{\text{p}}-\text{ y}_{\text{p}}+\text{b}_{\text{p}}\right|}{\sqrt{\text{k}_{\text{p}}^{2}+1}} \tag{18}\]  
Step 2: Form a line \(L_{2}\) through linear interpolation using the points \(P_{\text{st}}\) and \(P_{\text{ed}}\). Traverse all light stripe center points between these two points, and use Equation (18) to calculate the distance \(d_{pm}\) to the line \(L_{2}\). The point corresponding to the maximum distance \(d_{\text{max2}}\) is selected as the rough extraction point for the feature point \(P_{\text{v2}}\). Step 3: Form a line \(L_{3}\) using the points \(P_{\text{v1}}\) and \(P_{\text{ed}}\) through linear interpolation. Traverse all light stripe center points between these two points, and use Equation (18) to calculate the distance \(d_{\text{p}k}\) to the line \(L_{3}\). The point corresponding to the maximum distance \(d_{\text{max3}}\) is selected as the rough extraction point for the feature point \(P_{\text{v3}}\). The maximum distance search method has a fast computation rate, but its accuracy is significantly impacted by noise, making the extracted feature points suitable only for rough approximations. To obtain precise feature points for V-shaped weld seams, further optimization is conducted based on the results of the maximum distance search method. The specific steps are as follows:  
Step 1: Use the rough extraction points from the maximum distance search method as division boundaries, dividing the light stripe into four intervals: [\(P_{\text{st}}\),\(P_{\text{v2}}\)], [\(P_{\text{v2}}\),\(P_{\text{v1}}\)], [\(P_{\text{v1}}\),\(P_{\text{v3}}\)], and [\(P_{\text{v3}}\),\(P_{\text{ed}}\)]. Step 2: Perform least-squares linear fitting on all points within the intervals [\(P_{\text{st}}\),\(P_{\text{v2}}\)], [\(P_{\text{v2}}\),\(P_{\text{v1}}\)], [\(P_{\text{v1}}\),\(P_{\text{v3}}\)], and [\(P_{\text{v3}}\),\(P_{\text{ed}}\)], resulting in four line segments: \(L_{\text{P1}}\), \(L_{\text{P2}}\), \(L_{\text{P3}}\), and \(L_{\text{p4}}\). Step 3: The intersection points \(P_{L12}\), \(P_{L23}\), and \(P_{L34}\), where \(L_{\text{P1}}\) intersects \(L_{\text{P2}}\), \(L_{\text{P2}}\) intersects \(L_{\text{P3}}\), and \(L_{\text{P3}}\) intersects \(L_{\text{P4}}\), are selected as the final precise feature points. Figure 8 shows the results of the proposed method for extracting V-shaped weld seam features. Figure 8a presents the original image. Figure 8b shows the rough results obtained by the maximum distance search method, with feature points marked as red dots. However, as this method relies exclusively on geometric characteristics, it demonstrates  
Figure 7: Schematic diagram of the maximum distance search method for feature point extraction.