# Laser Spot Centering Algorithm of Double-Area Shrinking Iteration Based on Baseline Method
## 4 Results and Discussion  
### Simulation  
The human eye can recognize gray images much less well than color due to the special structure of the human eye; thus, it is necessary to make some pseudo-color processing of gray images to improve people's ability to distinguish the details of images. A certain pseudo-color image processing process is needed for the gray image for a Gaussian distribution of the spot in order to display the details of the spot image in a gradient, in which each gray level of the image is mapped one by one according to a linear or nonlinear function, and different gray levels correspond to different pseudo-colors, so as to achieve the purpose of image enhancement to some extent. As shown in Figure 5, MATLAB was used for simulation to generate ideal laser spot images with the radius of 20 pixels on the center of a size of 256 \(\times\) 256 pixels. The central position was (128, 128). The CCD camera's own noise has a large impact on the image of the laser spot. In order to simulate a noisy environment, random noise was added to the laser spot image using a given signal-to-noise ratio (SNR) according to the random noise characteristics of the CCD. As shown in Figure 6, to imitate the real environment and to verify the feasibility of the method in this paper, we added random noise with different SNRs to the laser spot images, which reflect the changes in the images from low to high SNRs. We generate 10 background noise images for each of the different SNRs, and then an optimal baseline value is calculated using the statistical method of background noise baseline proposed in this paper, which makes it possible to effectively filter out the background noise in the spot image while retaining the true spot information of the laser as much as possible. After the effective elimination of background noise, the threshold value of the difference between the radii of the two spot areas is set \(\xi=0.1\), iterative area shrinkage is performed based on the difference between the radii of the two newly obtained spot areas, and the real spot area is located until the end-of-iteration condition is satisfied, allowing the center of the spot to be calculated. As shown in Figure 7, the method proposed in this paper and some popular algorithms were used to compare the deviation of the detected spot center from the true spot center after the corresponding denoising of the spot image. With the gradual increase in image SNR, the deviation between the detected spot center and the real spot center determined using the Gaussian fitting algorithm, traditional centroid method, and square-weighted centroid method decreases rapidly, and the center localization accuracy improves. However, these methods are easily affected by background noise. The deviation between the center positioning results of x-axis and y-axis and the true center is more than 0.2 pixels when the interference from background noise is large (SNR = 12.5), and the fluctuation range of the center positioning results is larger as the SNR of the image increases. In contrast, the method proposed in this paper could find the center of the laser spot accurately under the interference of background noise, with the maximum centering accuracy reaching 0.05 pixels, and the deviation of the spot centering results fluctuated slightly. The iterative convergence of the spot area in this paper is shown in Figure 8. The spot area stabilized at the third-fourth iterations, and the final spot center was calculated. Figure 9 shows the comparison of the running time of different algorithms. Although the computational complexity of this paper's algorithm is higher than that of the traditional and square-weighted centroid methods, our algorithm was less complex than that of the Gaussian fitting algorithm, and our average running time was 0.061 s, thus meeting the real-time requirement. Therefore, the positioning accuracy and running efficiency of the spot center localization method in this paper could obtain better results.