A method for determining laser spot radius and center position

By combining adaptive dynamic thresholding and Gaussian grayscale energy distribution characteristics, the accuracy and efficiency issues of laser spot radius measurement are solved, achieving high-precision spot radius and center positioning, which is applicable to laser processing, optical inspection, laser communication and other fields.

CN122492793APending Publication Date: 2026-07-31STATE GRID JIANGXI ELECTRIC POWER CO LTD RES INST +2
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
STATE GRID JIANGXI ELECTRIC POWER CO LTD RES INST
Filing Date
2026-04-28
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing methods for measuring laser spot radius are difficult to achieve accurate and efficient measurement, and traditional methods suffer from problems such as slow measurement speed, high destructiveness, and susceptibility to background noise interference.

Method used

An adaptive dynamic thresholding method combined with local neighborhood correction of the laser spot is adopted. Based on the Gaussian gray-scale energy distribution characteristics of the laser spot, the laser spot radius and center are determined by Gaussian weighted distance transformation, and the final laser spot radius is calculated by combining the equivalent area of ​​the laser spot.

Benefits of technology

It achieves high-precision measurement of spot radius and center coordinates, reduces system computing power consumption, improves edge positioning accuracy to sub-pixel level, and enhances the consistency between measurement results and actual laser applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492793A_ABST
    Figure CN122492793A_ABST
Patent Text Reader

Abstract

This invention discloses a method for determining the radius and center position of a laser spot, comprising: acquiring an original color image of the laser spot and converting it into a grayscale image; applying adaptive dynamic thresholding and local neighborhood correction to the grayscale image to obtain a spot region composed of white pixels; counting the number of white pixels and combining this with the actual physical area of ​​a single pixel to calculate the equivalent area and preliminary radius of the spot; determining the center position and maximum inscribed circle radius of the spot; and combining the Gaussian grayscale energy distribution characteristics of the laser spot with Gaussian weighted correction of the maximum inscribed circle radius, and then combining this with the preliminary radius to calculate the final radius. This invention combines adaptive thresholding with Gaussian weighted distance transformation to achieve a fusion of algorithm and geometry, enabling precise determination of the spot center and radius. It is suitable for non-contact beam profile measurement applications such as laser processing, optical inspection, laser communication, and medical lasers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of precision optical measurement and digital image processing technology, specifically a method for determining the radius and center position of a laser spot. Background Technology

[0002] Pulsed lasers possess advantages such as concentrated energy, high directionality, and strong penetration. Since their inception, laser technology has been widely applied in fields such as laser processing, optical inspection, laser communication, and medical lasers. Pulsed laser beam quality is a core indicator for evaluating the performance of a laser system, with the laser spot radius being a key parameter characterizing the laser beam's focusing characteristics, energy density distribution, and beam transmission factor. Accurate and efficient measurement of the laser spot radius is of great significance for research fields such as laser processing and laser ultrasonic testing.

[0003] In laser ultrasonic testing, the parameters of the laser source, such as the laser pulse width and laser spot radius, have a significant impact on the intensity and frequency of the ultrasound waves. For the laser pulse width, existing tunable pulsed lasers can set it through a built-in system. However, current methods struggle to accurately measure the laser spot radius. The precise calculation of the spot radius directly affects the testing results of laser ultrasound and indirectly reflects the performance stability and accuracy of the laser instrument.

[0004] Existing laser spot measurement methods include the DMD micromirror array method, CCD / CMOS camera direct imaging method, mechanical scanning pinhole method, and thermal paper burning method. These methods have significant drawbacks. For example, the mechanical scanning pinhole method is slow, the system is complex, and it requires a precision displacement stage; the thermal paper burning method relies on an ablation mechanism, which is destructive and only applicable to pulsed lasers within a certain energy range. Therefore, there is a need to propose a laser spot radius determination method that is simple in principle, computationally efficient, and easy to implement. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a method for determining the radius and center position of a laser spot, aiming to solve the problems in the background technology.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for determining the radius and center position of a laser spot, comprising the following steps: acquiring an original color image of the laser spot; converting the original color image into a grayscale image; performing adaptive dynamic thresholding and local neighborhood correction on the grayscale image of the spot to obtain a high-precision binarized image; counting the number of white pixels in the high-precision binarized image and calculating the equivalent area of ​​the spot; calculating the preliminary radius based on the equivalent area; combining the Gaussian grayscale energy distribution characteristics of the laser spot, incorporating grayscale energy information into the center positioning process, determining the maximum inscribed circle radius through Gaussian weighting, and calculating the final laser spot radius based on the preliminary radius and the maximum inscribed circle radius; finally, finding the pixel within the spot region that maximizes the Gaussian weighted distance as the optimal center coordinates of the spot.

[0007] Furthermore, adaptive dynamic thresholding processing is performed on the grayscale image of the laser spot, including: dividing the grayscale image into several local windows; dynamically setting the side length of the local windows based on the estimated expected diameter of the laser spot; calculating the average grayscale value and standard deviation of each local window; setting the adaptive threshold of the local window based on the average grayscale value, standard deviation, and adaptive coefficient; and binarizing the pixels within the local window based on the adaptive threshold: if the grayscale value of a pixel within the local window is greater than or equal to the adaptive threshold, it is set to white; if the grayscale value of a pixel within the local window is less than the adaptive threshold, it is set to black. After processing, a binarized image is obtained; the white pixels in the binarized image constitute the laser spot region.

[0008] Furthermore, a sub-pixel edge detection algorithm is introduced to correct the local neighborhood of the light spot in the binarized image. This includes: based on the binarized image, selecting pixels initially identified as light spot edges; for the selected light spot edge pixels, extracting gray-level change curves along their gradient direction; sampling along the gradient direction to obtain a gray-level value sequence; fitting the gray-level value sequence using a cubic spline interpolation function to obtain a one-dimensional continuous gray-level distribution function along the gradient direction; and based on the one-dimensional continuous gray-level distribution function along the gradient direction, determining the light spot edge position with sub-pixel accuracy by finding the inflection point where the second derivative of the gray-level change curve is zero, satisfying the condition... ; Represents a one-dimensional continuous gray-level distribution function along the gradient direction. The second derivative, This represents the coordinates of the spot edge position with subpixel precision. Based on the spot edge position with subpixel precision, the binarized image is reconstructed and corrected, and finally a high-precision binarized image after subpixel correction is output. The pixels at the edge of the light spot are defined as: belonging to the white light spot area, and having a preset neighborhood that simultaneously contains both white light spot pixels and black background pixels.

[0009] Furthermore, the specific process for counting the number of white pixels in the high-precision binarized image and calculating the equivalent area of ​​the laser spot is as follows: count the total number of white pixels in the high-precision binarized image; based on the total number of white pixels and the actual physical area represented by a single white pixel, calculate the equivalent area of ​​the laser spot. .

[0010] Furthermore, the specific process for calculating the preliminary radius based on the equivalent area is as follows: If the equivalent area of ​​the laser spot is circular, the preliminary spot radius can be calculated using the area formula. ; If the equivalent area of ​​the laser spot is elliptical, the spot region is processed using an ellipse fitting algorithm to obtain the semi-major axis and semi-minor axis. The geometric mean of the semi-major axis and semi-minor axis is then used as the initial spot radius. .

[0011] Furthermore, combining the Gaussian grayscale energy distribution characteristics of the laser spot, grayscale energy information is introduced into the center localization process. The maximum inscribed circle radius is determined by Gaussian weighting. The specific process of calculating the final laser spot radius based on the initial radius and the maximum inscribed circle radius is as follows: Using the grayscale image as the base plane, an xy coordinate system is established. Two straight lines parallel to the x-axis and two straight lines parallel to the y-axis are drawn, so that the laser spot is completely placed within the enclosed rectangle, and the four sides of the rectangle coincide with the outer edges of the edge pixels of the laser spot; the intersection of the diagonals of this rectangle is used as the initial center. Measure the initial center of the circle The shortest distance to the edge of the laser spot is denoted as the spot radius. and with the initial center and spot radius Construct the incircle , inscribed circle The point of tangency with the laser spot is denoted as At the tangent point Relative to the initial center On the other side, find the edge of the laser spot at a distance from the initial center. The farthest point Connect the initial center of the circle with a straight line. and points ; set the initial center Time The straight-line distance is denoted as the spot radius. ; set the initial center Along the initial center and points linear movement After determining the distance, a new center is obtained. Using this new center as the pivot, a Gaussian weighting function is defined based on the grayscale energy distribution information of the light spot. Then, using a Gaussian weighted distance transformation, the radius of the maximum inscribed circle is obtained. Combined with the preliminary spot radius With the radius of the largest inscribed circle The final laser spot radius is obtained. .

[0012] Furthermore, the specific process of finding the pixel that maximizes the Gaussian weighted distance within the spot region as the optimal center coordinate of the spot is as follows: Define the Gaussian weighted distance transform value for the spot region in the high-precision binarized image; within the spot region in the high-precision binarized image, find the pixel that maximizes the Gaussian weighted distance transform value as the optimal center coordinate of the spot.

[0013] Furthermore, a luminance-first method is used to convert the original color image into a grayscale image.

[0014] An electronic device includes a processor, a memory, and a bus, wherein the processor and the memory are connected via the bus, wherein the memory is used to store a set of program codes, and the processor is used to call the program codes stored in the memory to execute a method for determining the radius and center position of a laser spot.

[0015] A non-volatile computer storage medium storing computer-executable instructions that execute a method for determining the radius and center position of a laser spot.

[0016] Compared with existing technologies, the present invention has the following advantages:

[0017] (1) This invention achieves high-precision binarization segmentation of the spot region by combining adaptive dynamic threshold processing with local neighborhood correction of the spot. At the same time, it incorporates the Gaussian gray energy distribution characteristics of the laser spot into the process of center positioning and radius calculation. The maximum inscribed circle radius of the spot is accurately determined by Gaussian weighted distance transformation. The final spot radius is solved by combining the preliminary radius obtained by the equivalent area calculation of the spot. The overall scheme realizes the deep integration of image processing algorithm and geometric feature extraction. While greatly simplifying the spot measurement calculation process and reducing the system computing power consumption, it effectively solves the problems of low edge positioning accuracy, susceptibility to background noise interference, and poor matching degree between the center and radius calculation results and the actual energy distribution of the spot in traditional spot measurement methods. It can efficiently and stably obtain high-precision laser spot center coordinates and radius values, and can be widely adapted to various non-contact beam profile measurement application scenarios such as laser processing, optical detection, laser communication, and medical laser.

[0018] (2) The present invention uses a dynamic local window adapted to the expected diameter of the spot to carry out adaptive threshold segmentation. The segmentation threshold can be dynamically adjusted according to the gray-scale statistical characteristics and signal-to-noise ratio within the local window. The spot details are fully preserved in the high signal-to-noise ratio area at the center of the spot, and noise interference is effectively suppressed in the low signal-to-noise ratio areas at the edges and in the background. At the same time, the local neighborhood of the spot is reconstructed and corrected by a sub-pixel edge detection algorithm, which improves the edge positioning accuracy of the spot to the sub-pixel level. This effectively eliminates the boundary positioning error caused by pixel discretization in the traditional fixed threshold binarization method, greatly improves the accuracy of spot area extraction, and provides reliable basic data for the subsequent calculation of the center and radius of the spot.

[0019] (3) This invention fully combines the inherent Gaussian gray energy distribution characteristics of the laser spot, and uses a Gaussian weighting function to weight and correct the distance transformation results. It integrates the gray energy information of the spot into the process of center positioning and radius calculation, which can guide the center of the circle to converge to the region with the highest energy density of the spot. At the same time, the final spot radius is calculated by combining the preliminary radius obtained by the equivalent area method and the maximum inscribed circle radius determined by Gaussian weighting. This takes into account both the size characteristics of the overall outline of the spot and the actual energy distribution law of the laser spot. It effectively avoids the problem that the measurement results of traditional geometric measurement methods, which rely only on the outline features, have a large deviation from the actual energy range of the spot. This further improves the fit between the spot parameter measurement results and the actual application effect of the laser. Attached Figure Description

[0020] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is the initial grayscale image of the laser spot in this invention; Figure 3 This is a diagram showing the result of dividing the adaptive dynamic threshold of the light spot according to the present invention; Figure 4 This is the light spot image after binarization processing according to the present invention; Figure 5 This is the image of the light spot after adaptive dynamic thresholding and local neighborhood correction processing according to the present invention. Detailed Implementation

[0021] Example 1

[0022] like Figure 1 As shown, this invention proposes a method for determining the radius and center position of a pulsed laser spot. This method does not consume a large amount of resources, is very simple in principle, robust, computationally efficient, and easy to implement. It can calculate the radius value of the pulsed laser spot relatively accurately; the method includes the following steps: S0. Laser parameter setting: Select the laser wavelength of the pulsed laser based on the physical properties of the material being tested, such as the light absorption coefficient and thermal diffusivity. 532nm, pulse width 10ns, maximum laser energy The energy is 50 mJ, and the laser spot radius is unknown and needs to be measured.

[0023] S1. Laser Spot Image Acquisition: The laser beam emitted from the tunable pulsed laser is attenuated and then incident perpendicularly onto the diffuse reflection target surface; the position of the CCD camera is adjusted so that its optical axis is perpendicular to the target surface, and the focal length is adjusted to obtain a clear image of the laser spot; the original color image of the laser spot is captured, such as... Figure 2 As shown.

[0024] S2. Convert to grayscale image: The original color image of the laser spot is converted to a grayscale image using a brightness-first method. The conversion formula is as follows: ; In the formula, This represents the grayscale value, which is the brightness value of a single channel after a color image is converted to a grayscale image. , , These represent the brightness values ​​of the red, green, and blue channels of the original color image of the laser spot, respectively.

[0025] S3. Adaptive dynamic thresholding: Divide the grayscale image into several local windows, such as... Figure 3 As shown, the size of the local window directly affects the segmentation accuracy; in this embodiment, the segmentation accuracy is determined based on the estimated diameter of the laser spot. Dynamically set the side length of a local window , represented as: ; In the formula, This represents the estimated expected diameter of the laser spot, which can be estimated based on laser parameters or historical measurement data, and is expressed in pixels. This setting ensures that the local window contains a sufficient number of pixels in both the spot area and the background area, thus ensuring the effectiveness of the statistical features. For each local window, calculate its average grayscale value. and standard deviation : ; ; In the formula, Represents the set of pixels within a local window; This represents the total number of pixels within a local window; Represents local window pixels grayscale value; An adaptive threshold for the local window is set based on the average and standard deviation of its grayscale values ​​and the adaptive coefficient. : ; In the formula, This represents the adaptive coefficient, which is dynamically adjusted based on the signal-to-noise ratio of the local window. Define the signal-to-noise ratio of a local window for: ; Then the adaptive coefficient Represented as: ; In the formula, This represents the minimum value of the adaptive coefficient; This represents the maximum value of the adaptive coefficient; , These represent the maximum and minimum signal-to-noise ratios of the local window, respectively. The above adjustment formula allows for the use of a lower threshold in areas with high signal-to-noise ratios (the center of the spot) to retain more details, and a higher threshold in areas with low signal-to-noise ratios (the background or edges) to suppress noise. Adaptive threshold based on local window Binarize the pixels within the local window: if the grayscale value of a pixel within the local window is greater than or equal to the adaptive threshold of the local window... If the grayscale value of a pixel within the local window is less than the adaptive threshold of the local window, then set it to 255 (white). If it is black, then set it to 0 (black). After processing, a binarized image is obtained, such as... Figure 4 As shown, the white pixels in the binarized image constitute the light spot region; The binarization formula is expressed as follows: ; In the formula, This represents the grayscale value of a pixel within a local window; This represents the grayscale value of a pixel in the processed binary image.

[0026] S4. Local Neighborhood Correction for Light Spots: After adaptive threshold binarization, pixels are directly divided into foreground and background, resulting in edge positioning errors within 0.5 pixels. For precise light spot measurements, this error cannot be ignored. This embodiment further introduces a sub-pixel edge detection algorithm to correct the edge region. Based on the binarized image, pixels initially identified as light spot edges are selected: these pixels belong to the white light spot region set to 255, and their preset neighborhood (e.g., a 3×3 neighborhood) simultaneously contains both light spot pixels set to 255 and background pixels set to 0; for the selected light spot edge pixels, grayscale change curves are extracted along their gradient direction. gradient direction Calculated using the Sobel operator: ; ; In the formula, Represents the gradient in the horizontal direction; Indicates the gradient in the vertical direction; This represents the input grayscale image; Represents the arctangent function; Gray value sequence is obtained by sampling along the gradient direction. , This represents the grayscale value of the pixel at the current edge center point, that is, the grayscale value of the selected pixel located at the center of the light spot edge; This represents the grayscale value of the pixel at the farthest sampling point from the edge center to the bright side; This represents the grayscale value of a pixel one step away from the center of the edge towards the brighter side; This represents the grayscale value of a pixel one step towards the darker side from the edge center; This represents the grayscale value of the pixel furthest from the edge center to the dark side; A cubic spline interpolation function is used to fit the gray value sequence to obtain a one-dimensional continuous gray value distribution function along the gradient direction. , represented as: ; In the formula, This function represents the position coordinates along the gradient direction; Used to describe location The corresponding fitted grayscale value distribution; Indicates the first The left endpoint of each interval corresponds to the position coordinates of the i-th point in the discrete sampling sequence; Indicates the first The right endpoint of the nth interval corresponds to the nth interval in the discrete sampling sequence. The position coordinates of each point; This represents the constant term, which is equal to the left endpoint of the interval. The grayscale value at that location; This represents the coefficient of the linear term, corresponding to the left endpoint of the interval. The first derivative at a certain point reflects the grayscale curve at that point. Rate of change at; This represents the coefficient of the quadratic term, corresponding to the left endpoint of the interval. The second derivative is half of the second derivative, reflecting the change in the curvature of the curve; Represents the coefficient of the cubic term, the coefficient of the highest-order term of a cubic polynomial, used to fit the local curvature changes of a curve; Based on a one-dimensional continuous gray-level distribution function along the gradient direction By finding the inflection point where the second derivative of the grayscale variation curve is zero, the sub-pixel precision edge position of the light spot is determined. This edge position consists of continuous non-integer coordinates that break through the discrete pixel limitation and satisfy... ; express The second derivative, This represents the coordinates of the spot edge position with sub-pixel precision; Based on the sub-pixel precision of the spot edge position, the binarized image undergoes edge reconstruction and correction, replacing the original pixel-level coarse spot outline. The final output is a high-precision binarized image after sub-pixel correction, such as... Figure 5 As shown; This correction improves edge positioning accuracy to 0.1 pixels, effectively eliminating boundary errors introduced by pixel discretization in binarization processing.

[0027] S5. Calculate the equivalent area of ​​the light spot: Count the total number of white pixels (pixels with a grayscale value of 255) in the high-precision binarized image. Based on the total number of white pixels and the actual physical area represented by a single white pixel, the equivalent area of ​​the laser spot is calculated. , represented as: ; In the formula, This represents the actual physical area represented by a single white pixel. The smaller this value is, the more accurate the final laser spot radius value will be.

[0028] In this embodiment, the final number of white pixels is 139, and the actual physical area represented by a single pixel is... for The final calculated equivalent area of ​​the laser spot is: .

[0029] S6. Preliminary calculation of laser spot radius: Based on the calculated equivalent area of ​​the laser spot, calculate the size of the laser spot radius; specifically: If the equivalent area of ​​the laser spot is circular, the preliminary spot radius can be calculated using the area formula. : ; If the equivalent area of ​​the laser spot is elliptical, the spot region can be processed using an ellipse fitting algorithm to obtain the semi-major axis. and semi-short axis With semi-major axis and semi-short axis The geometric mean is used as the initial spot radius. : ; ; ; In the formula, Indicates the number of pixels on the semi-major axis; Indicates the number of pixels on the semi-minor axis; The side length of a square represents a single pixel (in the field of digital image processing, a pixel is often abstracted as a square).

[0030] S7. Determine the final laser spot radius and center: Using the grayscale image as the base plane, establish an xy coordinate system. Draw two straight lines parallel to the x-axis and two straight lines parallel to the y-axis, ensuring the laser spot is completely within the enclosed rectangle, with the four sides of the rectangle coinciding with the outer edges of the laser spot's edge pixels. Use the intersection of the rectangle's diagonals as the initial center. Measure the initial center of the circle The shortest distance to the edge of the laser spot is denoted as the spot radius. and with the initial center and spot radius Construct the incircle , inscribed circle The point of tangency with the laser spot is denoted as At the tangent point Relative to the initial center On the other side, find the edge of the laser spot at a distance from the initial center. The farthest point Connect the initial center of the circle with a straight line. and points ; set the initial center Time The straight-line distance is denoted as the spot radius. ; set the initial center Along the initial center and points linear movement After distance (assuming) A new center is obtained. Using this new center as the center, a Gaussian weighting function is defined based on the gray-scale energy distribution information of the light spot. Then, using a Gaussian weighted distance transform, the radius of the maximum inscribed circle is obtained. Combined with the preliminary spot radius With the radius of the largest inscribed circle The final laser spot radius is obtained. ; Finally, within the spot area, the pixel that maximizes the Gaussian weighted distance is selected as the center of the spot. Specifically: Gaussian weighted distance transform: For the spot region in a high-precision binarized image, a Gaussian weighted distance transform value is defined: ; In the formula, Represents any pixel within the spot region of a high-precision binarized image. Gaussian weighted distance transform value; Represents any pixel within the spot region in a high-precision binarized image. The minimum Euclidean distance to the boundary of the light spot area, i.e., the shortest distance; A Gaussian weighted function that incorporates grayscale energy distribution information; Represented as: ; In the formula, The set of pixels representing the area of ​​the light spot; ; Represents the boundary pixel coordinates, which are The coordinates of all pixels on the edges of the light spots; Represents boundary operators; Represented as: ; In the formula, Represents the natural exponential function; Represents pixels The gray-level gradient magnitude at a given point is calculated using the Sobel operator. This represents the Gaussian kernel scale parameter, which is taken in this embodiment. The weighting function takes a larger value in areas with gentle gray-level changes and a smaller value in areas with drastic gray-level changes, thus guiding the center of the circle to shift towards areas with higher energy density.

[0031] Center positioning: Based on the Gaussian weighted distance transformation results, the optimal center coordinates of the light spot are determined; Within the spot region of a high-precision binarized image, find the value of the Gaussian weighted distance transform. The pixel with the maximum value is used as the optimal center coordinate of the light spot. : ; Since the Gaussian weighted distance transform is typically a unimodal function in the spot region, it can be solved quickly using the hill-climbing method or Newton's iteration method. However, the hill-climbing method is sensitive to the selection of the initial point. If the initial point is not at the global optimum, it may get stuck in local extrema, and the search direction may be limited to up, down, left, right, or diagonal. It converges slowly and is inefficient in regions where the grayscale value changes little. This embodiment uses an improved hill-climbing method: Choose an initial estimation point (such as the center of the spot area) as the initial point. At the current point At this point, calculate the objective function. gradient ; along the gradient direction Perform a search in the direction Go up and find the step length. Make Update location ,in To achieve the optimal step size, Indicates the first The update point of the next iteration.

[0032] when When the value is 0.1 pixels (e.g., at a certain value), stop iterating. As the center of the light spot; This represents the convergence threshold.

[0033] In this embodiment, the hill-climbing method is used: starting from the initial estimation point (such as the centroid of the light spot region), the search is iteratively performed along the gradient direction until it converges to a local maximum.

[0034] A second embodiment of the present invention also provides an electronic device, including a processor, a memory, and a bus, wherein the processor and the memory are connected via the bus, wherein the memory is used to store a set of program code, and the processor is used to call the program code stored in the memory to execute a method for determining the radius and center position of a laser spot.

[0035] A second embodiment of the present invention also provides a non-volatile computer storage medium storing computer-executable instructions that execute a method for determining the radius and center position of a laser spot.

[0036] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for determining the radius and center position of a laser spot, characterized in that, The process includes the following steps: acquiring the original color image of the laser spot; converting the original color image to a grayscale image; applying adaptive dynamic thresholding and local neighborhood correction to the grayscale image to obtain a high-precision binarized image; counting the number of white pixels in the high-precision binarized image and calculating the equivalent area of ​​the spot; calculating the preliminary radius based on the equivalent area; incorporating the Gaussian grayscale energy distribution characteristics of the laser spot into the center localization process, determining the maximum inscribed circle radius through Gaussian weighting, and calculating the final laser spot radius based on the preliminary radius and the maximum inscribed circle radius; finally, finding the pixel within the spot region that maximizes the Gaussian weighted distance as the optimal center coordinates of the spot.

2. The method for determining the radius and center position of a laser spot according to claim 1, characterized in that: Adaptive dynamic thresholding processing is performed on the grayscale image of the laser spot, including: dividing the grayscale image into several local windows; dynamically setting the side length of the local windows based on the estimated expected diameter of the laser spot; calculating the average grayscale value and standard deviation of each local window; setting the adaptive threshold of the local window based on the average grayscale value, standard deviation, and adaptive coefficient; and binarizing the pixels within the local window based on the adaptive threshold: if the grayscale value of a pixel within the local window is greater than or equal to the adaptive threshold, it is set to white; if the grayscale value of a pixel within the local window is less than the adaptive threshold, it is set to black. After processing, a binarized image is obtained; the white pixels in the binarized image constitute the laser spot region.

3. The method for determining the radius and center position of a laser spot according to claim 2, characterized in that: A sub-pixel edge detection algorithm is introduced to correct the local neighborhood of light spots in a binarized image. This includes: screening pixels initially identified as light spot edges based on the binarized image; extracting gray-level change curves along the gradient direction for the screened edge pixels; sampling gray-level value sequences along the gradient direction; fitting the gray-level value sequences using a cubic spline interpolation function to obtain a one-dimensional continuous gray-level distribution function along the gradient direction; and determining the sub-pixel precision light spot edge position by finding the inflection point where the second derivative of the gray-level change curve is zero, satisfying the condition... ; Represents a one-dimensional continuous gray-level distribution function along the gradient direction. The second derivative, This represents the coordinates of the spot edge position with subpixel precision. Based on the spot edge position with subpixel precision, the binarized image is reconstructed and corrected, and finally a high-precision binarized image after subpixel correction is output. The pixels at the edge of the light spot are defined as: belonging to the white light spot area, and having a preset neighborhood that simultaneously contains white light spot pixels and black background pixels.

4. The method for determining the radius and center position of a laser spot according to claim 3, characterized in that: The specific process for counting the number of white pixels in a high-precision binarized image and calculating the equivalent area of ​​the laser spot is as follows: Count the total number of white pixels in the high-precision binarized image; based on the total number of white pixels and the actual physical area represented by a single white pixel, calculate the equivalent area of ​​the laser spot. .

5. The method for determining the radius and center position of a laser spot according to claim 4, characterized in that: The specific process for calculating the preliminary radius based on the equivalent area is as follows: If the equivalent area of ​​the laser spot is circular, the preliminary spot radius can be calculated using the area formula. ; If the equivalent area of ​​the laser spot is elliptical, then the spot region is processed using an ellipse fitting algorithm to obtain the semi-major axis and semi-minor axis. The geometric mean of the semi-major axis and semi-minor axis is used as the initial spot radius. .

6. The method for determining the radius and center position of a laser spot according to claim 5, characterized in that: Combining the Gaussian grayscale energy distribution characteristics of the laser spot, grayscale energy information is incorporated into the center localization process. The maximum inscribed circle radius is determined through Gaussian weighting. The specific process for calculating the final laser spot radius based on the initial radius and the maximum inscribed circle radius is as follows: Using the grayscale image as the base plane, an xy coordinate system is established. Two straight lines parallel to the x-axis and two straight lines parallel to the y-axis are drawn, ensuring that the laser spot is completely placed within the enclosed rectangle, with the four sides of the rectangle coinciding with the outer edges of the laser spot's edge pixels. The intersection of the diagonals of this rectangle is used as the initial center. Measure the initial center of the circle The shortest distance to the edge of the laser spot is denoted as the spot radius. and with the initial center and spot radius Construct the incircle , inscribed circle The point of tangency with the laser spot is denoted as At the tangent point Relative to the initial center On the other side, find the edge of the laser spot at a distance from the initial center. The farthest point Connect the initial center of the circle with a straight line. and points ; set the initial center Time The straight-line distance is denoted as the spot radius. ; set the initial center Along the initial center and points linear movement After determining the distance, a new center is obtained. Using this new center as the pivot, a Gaussian weighting function is defined based on the grayscale energy distribution information of the light spot. Then, using a Gaussian weighted distance transformation, the radius of the maximum inscribed circle is obtained. Combined with the preliminary spot radius With the radius of the largest inscribed circle The final laser spot radius is obtained. .

7. The method for determining the radius and center position of a laser spot according to claim 6, characterized in that: The specific process of finding the pixel that maximizes the Gaussian weighted distance within the spot region as the optimal center coordinate of the spot is as follows: Define the Gaussian weighted distance transform value for the spot region in the high-precision binarized image; within the spot region in the high-precision binarized image, find the pixel that maximizes the Gaussian weighted distance transform value as the optimal center coordinate of the spot.

8. The method for determining the radius and center position of a laser spot according to claim 1, characterized in that: The original color image is converted into a grayscale image using a luminance-first method.

9. An electronic device, characterized in that, The device includes a processor, a memory, and a bus, wherein the processor and the memory are connected via the bus, and the memory is used to store a set of program code, and the processor is used to call the program code stored in the memory to execute a method for determining the radius and center position of a laser spot as described in any one of claims 1-8.

10. A non-volatile computer storage medium storing computer-executable instructions, characterized in that, The computer can execute instructions to perform a method for determining the radius and center position of a laser spot as described in any one of claims 1-8.