## 3 The Improved Laser Line Extraction
The grayscale center of gravity method can fully reflect the change in grayscale value, so the center pixel coordinates extracted after smoothing are extracted quadratically by using the grayscale center of gravity method. The grayscale center of gravity method is used to extract the center line coordinates of laser lines by using the pixel point coordinates and the grayscale value of pixel points. The method is to calculate the \"mass\" position of a column of pixel grayscale values. The result is a centroid coordinate; the calculation method is shown in Formula (7):  
\[\left\{ \begin{matrix}u_{j}=j\\ v_{j}=\frac{\sum_{i}iG(i,j)}{\sum_{i}G(i,j)}\end{matrix} \right. \tag{7}\]  
where \(\left(u_{j},v_{j}\right)\) represents the centerline extraction of the \(j\)-row laser stripe and \(G(i,j)\) represents the grayscale value of the \(j\)-row, \(i\)-column pixel. As can be seen from the grayscale center of gravity method, the grayscale center of gravity method is solved by selecting the threshold area, and the grayscale value in the region will have an effect on the final solution. Because of the above factors, on the basis of using the Gaussian fuzzy removal image flat roof phenomenon, the gray threshold value is set to automatically extract the laser line width. As shown in Figure 8, the grayscale center of gravity method is improved by using the open window thought to select the solving area in this work. From Figure 8, it is clear that the Gaussian curve removing the flat roof phenomenon better fits the grayscale distribution. There are some deviations between the extreme \(x=1165.115\) and the extreme, which did not remove the flat top phenomenon, \(x=1165.205\). After the above analysis, the grayscale center of gravity method that can fully reflect the grayscale change is selected, and the center point \(x_{max}\) and the calculation range \(R\) of the grayscale center of gravity method is calculated. The center point \(x_{max}\) is the transverse coordinate of the maximum point of grayscale value after filtering. The calculation range R is \(2D/3\) times the number of pixels in horizontal coordinates, where \(D\) is the line width of the laser line. The line width of the laser line is calculated by the number of sampling points after taking a certain threshold. This method adapts the line width of each laser line, thus bringing about a change in the range of the grayscale. Figure 9a is the original image; the laser stripe section will be traversed to accurately extract the center position in the method; Figure 9b is the image that is blurred and  
Figure 8: The Gaussian blur and its curve fitting. smoothed by Gaussian, extracting the \(u_{j}\) row cross-section; Figure 9c is the parameter calculation of the grayscale center of gravity method, extracts the highest point of grayscale value, and opens the window left and right to select the grayscale gravity area. According to Figure 6, the largest pixel point within the grayscale center of gravity range is coordinated, i.e., peak \(x_{max}=1165.115\), the point (\(x_{max}=1165\)) is considered as the center point round to open the window (the window size is \(2D/3\)). The grayscale value and the number of squares in the adjacent squares have a certain proportion to the grayscale center of gravity range, so that the grayscale peak coordinates of the grayscale image after the Gaussian fuzzy processing take the same length to extract the laser line. In Figure 9c, the blue area is a grayscale gravity area, \(x=1165\) is considered as the starting point, the grayscale threshold is set for the line width \(D\) of the laser line. The grayscale threshold is set to 50 and the line width \(D\) is set to 7. The left and right lengths \(L=2D/3\) are selected. After rounding, the L is equal to 4, and then the grayscale center of gravity method is conducted. Figure 9d is the extracted result, and the center point coordinates obtained by the grayscale center of gravity method is \(v_{j}\), i.e., the extracted central coordinate point is (\(v_{j}\), \(u_{j}\)).