## 4 Feature Extraction  
### Light Spot Feature Extraction  
To extract the spot center more accurately and efficiently, the spot features in the image need to be segmented in advance. Considering that the laser pointer emits a 660 nm red laser, the corresponding threshold value can be set for each component in the HSV color space to filter out other stray light in the background. The processing results are shown in Figure 3b. Among them, the ranges of H, S, and V can be set as 0\(\sim\)10, 43\(\sim\)255, and 46\(\sim\)250, respectively. Then, the laser spot contour ROI is obtained via contour detection, as shown in Figure 3c. Finally, the ROI of the spot is segmented to obtain the spot map, as shown in Figure 3d. Figure 4 illustrates the grayscale analysis of the light spot. Figure 4a shows the spot image, and Figure 4b depicts the grayscale distribution of the spot. It can be observed that within a large central area of the spot, the grayscale values approach 255, exhibiting a \"flat top\" phenomenon. Therefore, traditional Gaussian fitting methods are inadequate for solving the center extraction problem of such spots. The image of a two-dimensional Gaussian function is shown in Figure 4c. Research referenced in [28] suggests that adjusting the parameters of a two-dimensional arctangent function can achieve an approximation of the \"flat top\" effect, as depicted in Figure 4d. Hence, this paper proposes a spot-centered extraction method based on a two-dimensional arctangent function to address the aforementioned issue. Figure 3: Laser spot segmentation results: (**a**) original image; (**b**) HSV segmentation; (**c**) contour detection; (**d**) result. Analogous to the fitting method based on the Gaussian function, the fitting function, can be defined as follows:  
\[F(x,y)=E_{max}\arctan\left(-\frac{\left(x-x_{0}\right)^{2}}{a_{x}^{2}}-\frac{ \left(y-y_{0}\right)^{2}}{a_{y}^{2}}+\alpha\right)+\frac{E_{max}\pi}{2} \tag{24}\]  
where  
\(E_{max}\) denotes the maximum value of the spot energy, i.e., the maximum value of the spot grayscale;  
\((x_{0},y_{0})\) denotes the coordinates of the spot center;  
\(a_{x}\) denotes the semi-long axis of the spot;  
\(b_{x}\) denotes the semi-short axis of the spot;  
\(\alpha\) denotes the correction factor--\(0<\alpha<1\) when the image of the fitted function tends to be \"spiky\", and \(\alpha>1\) when the image of the fitted function tends to be \"flat\";  
\(\frac{E_{max}\pi}{2}\) denotes the compensation factor, which can ensure that the fitted function is always greater than or equal to 0. Therefore, the extraction of the spot center can be transformed into the determination of unknown parameters in the fitting function, especially in the case of \((x_{0},y_{0})\). However, the solving process of the parameters in the formula is nonlinear, so the following equivalent transformation is made for (24):  
\[\frac{F(x,y)-\frac{E_{max}\pi}{2}}{E_{max}}=\arctan\left(-\frac{\left(x-x_{0} \right)^{2}}{a_{x}^{2}}-\frac{\left(y-y_{0}\right)^{2}}{a_{y}^{2}}+\alpha\right) \tag{25}\]  
Figure 4: Analysis of the grayscale situation of the light spot: (**a**) spot image; (**b**) grayscale distribution; (**c**) 2D Gaussian function; (**d**) 2D arctangent function.