Intelligent vision-based laser axis centering method, device and system
Patent Information
- Application Number
- CN202611486039.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-23
- Publication Date
- 2026-10-27
AI Technical Summary
[0004]然而,受镜片污染、光束散射、环境光干扰及采集参数变化等因素影响,实际工况下的光斑图像常出现过曝、拖尾、灰度不均及形态畸变等现象,导致现有基于灰度分布假设的中心定位方法在复杂工况下的定位精度下降
[0019]本申请具有如下有益效果:本申请通过多层级灰度分割与边缘提取获得光斑轮廓边界点集,能够在光斑过曝、灰度不均的复杂工况下保留完整的边缘信息;通过将轮廓边界点集划分为多个弧段并在非邻接弧段之间建立跨弧段约束弦,利用中垂线空间交汇关系获得候选中心点集合,使得中心定位不依赖灰度分布假设,有效抑制局部拖尾、畸变及缺损对定位结果的干扰;通过对候选中心点集合进行空间密度聚类确定主中心簇及定位置信度,能够反映多数几何约束共同指向的共识中心,并为定位结果提供可靠性量化依据;通过结合中心偏移量与允许偏差阈值以及定位置信度与预设置信度参考阈值进行双重校验,避免了异常轮廓对轴对中判定的误导,提升了激光轴对中校准的精度和安全性。
Smart Images

Figure CN122989774A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, specifically to a laser axis alignment method, apparatus, and system based on intelligent vision. Background Technology
[0002] In the field of laser processing, the positional accuracy of the laser beam as it exits the center of the nozzle directly determines the processing quality and equipment safety. To avoid nozzle burnout, reduced kerf quality, or decreased processing accuracy due to beam deviation, it is usually necessary to perform axis alignment calibration on the laser processing head before starting the equipment, after maintenance, or after replacing the nozzle. This calibration process relies on the accurate detection and positioning of the center position of the laser spot.
[0003] Currently, the industry commonly uses coaxial instruments for in-situ detection. This involves acquiring laser spot images using an industrial camera and centering the laser spot based on its grayscale distribution characteristics. The centering status is then determined based on the offset between the spot center and the reference center. When the offset exceeds the allowable range, the operator manually adjusts the position of the laser processing head. This method can achieve good positioning results under ideal conditions where the spot shape is regular and the grayscale distribution is uniform.
[0004] However, due to factors such as lens contamination, beam scattering, ambient light interference, and changes in acquisition parameters, the spot images under actual working conditions often exhibit overexposure, trailing, uneven grayscale, and morphological distortion, leading to a decrease in the positioning accuracy of existing center positioning methods based on grayscale distribution assumptions under complex working conditions. Summary of the Invention
[0005] To address the technical challenge of effectively improving the positioning accuracy of the laser spot center under practical working conditions, this application aims to provide a laser axis alignment method, device, and system based on intelligent vision. The specific technical solution adopted is as follows: Firstly, a laser axis alignment method based on intelligent vision is provided. This method includes: acquiring a laser spot image; performing multi-level grayscale segmentation and edge extraction on the laser spot image to obtain a set of contour boundary points of the laser spot; determining the number of contour segments based on the contour boundary point set, and dividing the contour boundary point set into multiple arc segments according to the number of contour segments; establishing cross-arc constraint chords between non-adjacent arc segments in the multiple arc segments, generating perpendicular bisectors of the cross-arc constraint chords; and obtaining a set of candidate center points based on the spatial intersection relationship between the perpendicular bisectors. Spatial density clustering is performed on the candidate center point set, and the cluster containing the most candidate center points is selected as the main center cluster. The target spot center and positioning confidence are determined based on the main center cluster. The center offset is calculated based on the target spot center and a preset reference center, and the alignment status of the laser spot is determined based on the comparison results of the center offset and the allowable deviation threshold, and the comparison results of the positioning confidence and the preset confidence reference threshold.
[0006] One possible approach involves acquiring a laser spot image, performing multi-level grayscale segmentation and edge extraction on the laser spot image to obtain a set of contour boundary points for the laser spot. This includes: converting the laser spot image to grayscale to obtain a grayscale image; filtering the grayscale image; dividing the grayscale image into multiple grayscale levels according to a preset multi-level threshold segmentation algorithm; extracting the interface pixels between adjacent level regions to obtain a set of candidate edge pixels; performing edge detection on the candidate edge pixel set to extract the spot boundary; processing the spot boundary contour to obtain a closed contour; selecting the main boundary contour from the closed contour based on the contour area; performing edge localization processing on the main boundary contour; and sorting the located edge points to generate an ordered closed contour boundary point set composed of multiple coordinate points.
[0007] One possible approach involves determining the number of contour segments based on the contour boundary point set, and then dividing the contour boundary point set into multiple arc segments according to the number of contour segments. Cross-arc constraint chords are established between non-adjacent arc segments within these multiple arc segments. This includes: calculating the contour area and contour perimeter corresponding to the contour boundary point set; determining a contour complexity evaluation value to characterize the regularity of the light spot morphology based on the contour area and contour perimeter; determining the number of contour segments based on the contour complexity evaluation value; dividing the contour boundary point set into multiple continuous arc segments based on the cumulative arc length of the contour, and selecting sampling points within each continuous arc segment; selecting a target arc segment from among the multiple continuous arc segments; and determining paired arc segments that are more than a preset distance threshold from the target arc segment in the contour sequence. The paired arc segments are those located opposite the target arc segment in the contour sequence. The sampling points of the target arc segment and the sampling points of the paired arc segments are combined and connected to construct multiple cross-segment connecting lines, and all cross-segment connecting lines constitute cross-arc constraint chords. Additional arc segments are selected within the neighborhood of the paired arc segments. The target arc segment and the additional arc segments are paired to form multiple sets of cross-regional geometric constraints. The sampling points of the target arc segment and the sampling points of the additional arc segments are combined and connected to construct additional cross-segment connecting segments. The cross-segment connecting segments and the additional cross-segment connecting segments together constitute cross-arc constraint chords.
[0008] One possible approach is to generate the perpendicular bisectors of the cross-arc constraint chords. Based on the spatial intersection relationships between the perpendicular bisectors, a set of candidate center points is obtained. This includes: for each cross-arc constraint chord, determining the geometric midpoint and direction vector of the cross-arc constraint chord, and determining the perpendicular normal vector of the cross-arc constraint chord based on the direction vector. Starting from the geometric midpoint, extending a preset distance to both sides along the perpendicular normal vector generates the perpendicular bisectors corresponding to each cross-arc constraint chord. Pairwise combinations of perpendicular bisectors with an angle smaller than a preset angle threshold are eliminated. The remaining combinations of perpendicular bisectors are then spatially intersected. Intersections within the area enclosed by the contour boundary point set or within the effective analysis range are retained as candidate center points. The set of candidate center points is composed of all candidate center points.
[0009] One possible approach involves spatial density clustering of the candidate center point set, selecting the cluster containing the most candidate center points as the master center cluster, and determining the target spot center and location confidence based on the master center cluster. This includes: performing a preset density clustering algorithm on the candidate center point set to obtain multiple candidate center clusters, and determining the candidate center cluster containing the most candidate center points as the master center cluster; calculating the arithmetic mean of the coordinates of all candidate center points in the master center cluster, which is then used as the target spot center; and calculating the ratio of the number of candidate center points in the master center cluster to the total number of candidate center points in the candidate center point set, using this ratio as the location confidence, which characterizes the degree to which candidate center points converge towards a single central region.
[0010] One possible approach is to calculate the center offset based on the target spot center and a preset reference center, and then determine the laser spot's alignment status based on a comparison of the center offset with an allowable deviation threshold. This includes calculating the horizontal and vertical offsets between the target spot center and the preset reference center, and determining the center offset based on these offsets. When the center offset is less than or equal to the allowable deviation threshold, the laser spot is considered to be in a qualified alignment state. When the center offset is greater than the allowable deviation threshold, the laser spot is considered to be in an offset state, and adjustment prompts are generated based on the signs of the horizontal and vertical offsets.
[0011] As one possible implementation, the method further includes: comparing the location confidence with a preset confidence reference threshold; when the location confidence is less than the preset confidence reference threshold, performing at least one of the following correction operations: re-dividing the arc segments based on the current contour boundary point set to reconstruct the cross-arc constraint chords; re-selecting sampling points within each arc segment to construct a new set of cross-arc constraint chords; re-performing spatial density clustering to obtain a new main center cluster; or, outputting a spot anomaly warning information.
[0012] As one possible approach, the preset reference center is determined through factory calibration, installation calibration, or image calibration. The preset reference center corresponds to the geometric center of the coaxial detection area, and the preset reference center does not change during the detection process.
[0013] Secondly, a laser axis alignment device based on intelligent vision is provided, comprising: The image acquisition and contour extraction unit is used to acquire laser spot images, perform multi-level grayscale segmentation and edge extraction on the laser spot images, and obtain the contour boundary point set of the laser spot.
[0014] The contour segmentation and constraint construction unit is used to determine the number of contour segments based on the contour boundary point set, and divide the contour boundary point set into multiple arc segments according to the number of contour segments. Cross-arc constraint chords are established between non-adjacent arc segments in the multiple arc segments.
[0015] The central solution unit is used to generate the perpendicular bisector of the constraint chord across the arc segment. Based on the spatial intersection relationship between the perpendicular bisectors, a set of candidate center points is obtained. The set of candidate center points is then subjected to spatial density clustering. The cluster containing the most candidate center points is selected as the main center cluster. The center of the target spot and the location confidence are determined based on the main center cluster.
[0016] The centering determination unit is used to calculate the center offset based on the center of the target spot and the preset reference center, and to determine the centering status of the laser spot based on the comparison results of the center offset and the allowable deviation threshold, as well as the comparison results of the positioning reliability and the preset reliability reference threshold.
[0017] Thirdly, a laser axis alignment system based on intelligent vision is provided, including the laser axis alignment device based on intelligent vision as described in the second aspect.
[0018] The laser axis alignment system based on intelligent vision also includes an image acquisition module and a result output module. The image acquisition module is used to acquire laser spot images and transmit them to the image acquisition and contour extraction unit. The result output module is used to output the result information obtained by the centering determination unit. The result information includes the centering status, adjustment prompts, and abnormal spot prompts.
[0019] This application has the following beneficial effects: It obtains the set of boundary points of the light spot contour through multi-level grayscale segmentation and edge extraction, which can preserve complete edge information under complex working conditions such as overexposure and uneven grayscale. By dividing the contour boundary point set into multiple arc segments and establishing cross-arc constraint chords between non-adjacent arc segments, and using the spatial intersection relationship of the perpendicular bisectors to obtain the set of candidate center points, the center positioning does not depend on the grayscale distribution assumption, effectively suppressing the interference of local trailing, distortion, and defects on the positioning results. By performing spatial density clustering on the candidate center point set to determine the main center cluster and the positioning reliability, it can reflect the consensus center pointed to by most geometric constraints and provide a quantitative basis for the reliability of the positioning results. By combining the center offset with the allowable deviation threshold and the positioning reliability with the preset reliability reference threshold for dual verification, it avoids the misleading effect of abnormal contours on axis alignment judgment, and improves the accuracy and safety of laser axis alignment calibration. Attached Figure Description
[0020] Figure 1 A schematic flowchart illustrating a laser axis alignment method based on intelligent vision provided in one embodiment of this application; Figure 2 A schematic diagram of a laser axis alignment device based on intelligent vision provided in one embodiment of this application; Figure 3 This is a schematic diagram of the system architecture of a laser axis alignment system based on intelligent vision, provided as an embodiment of this application. Detailed Implementation
[0021] The following description, in conjunction with the accompanying drawings, details a specific scheme for a laser axis alignment method based on intelligent vision provided in this application.
[0022] Please see Figure 1 It illustrates a flowchart of a laser axis alignment method based on intelligent vision provided in one embodiment of this application, as follows: Figure 1 As shown, the method includes the following steps: S101. Acquire a laser spot image, perform multi-level grayscale segmentation and edge extraction on the laser spot image, and obtain the contour boundary point set of the laser spot.
[0023] The aforementioned laser spot image refers to a digital image of the luminous area formed by the laser beam on the detection surface, acquired by a coaxial instrument. Multi-level grayscale segmentation refers to an image processing method that divides an image into multiple grayscale level regions according to multiple different grayscale thresholds. Edge extraction refers to the operation of extracting boundary information from regions where grayscale abrupt changes occur in an image. A contour boundary point set refers to an ordered closed point set composed of multiple sub-pixel coordinate points, which can reflect the physical edge morphology of the laser spot.
[0024] In real-world laser processing scenarios, high-energy laser beams often create an overexposed core area with extremely high brightness on the target surface, resulting in highly uneven grayscale distribution across the entire spot. Multi-level grayscale segmentation is used to separate the overexposed core area, normal spot area, edge transition area, and background area from each other in the image. After separating the effective boundaries, edge extraction is performed to generate an ordered set of closed contour boundary points composed of multiple coordinate points.
[0025] S102. Determine the number of contour segments based on the contour boundary point set, and divide the contour boundary point set into multiple arc segments according to the number of contour segments. Establish cross-arc constraint chords between non-adjacent arc segments in the multiple arc segments.
[0026] The aforementioned number of contour segments refers to an adaptive partitioning parameter determined based on the morphological regularity of the light spot contour. An arc segment is a continuous edge fragment formed by uniformly dividing the contour boundary point set according to arc length. Non-adjacent arc segments are arc segments on the contour sequence with intervals exceeding a preset distance threshold. A cross-arc constraint chord is a set of line segments connecting sampling points on two non-adjacent arc segments. The preset distance threshold corresponds to half the number of contour segments; for example, when the number of contour segments is 10, the preset distance threshold is 5 arc segment intervals.
[0027] Determining the number of contour segments, dividing the arc segments, and establishing cross-arc constraint chords between non-adjacent arc segments are crucial to reducing interference from local distortions or edge defects in the laser spot's center positioning. In real-world laser processing scenarios, laser spot contours often exhibit tails, burrs, or localized gaps. Relying solely on constraints between adjacent arc segments can easily lead to inaccurate positioning results due to local noise. Therefore, determining the number of contour segments based on their morphological complexity ensures that the discrete division of irregular contours matches their morphological characteristics. After determining the number and dividing the arc segments, cross-arc constraint chords are then established between spatially non-adjacent arc segments (e.g., those located at the contour's diametrical points). These cross-arc constraint chords, distributed across different regions of the contour, form a geometric constraint network that reflects the overall structure of the contour.
[0028] S103. Generate the perpendicular bisector of the cross-arc constraint chord, and obtain the set of candidate center points based on the spatial intersection relationship between the perpendicular bisectors.
[0029] The aforementioned perpendicular bisector refers to a straight line perpendicular to the cross-arc constraint chord and passing through its midpoint. Spatial intersection refers to the geometric state in two-dimensional space where multiple perpendicular bisectors intersect at the same point or tend to converge. The candidate center point set is the set of spatial intersection points of multiple perpendicular bisectors, which reflects the common direction of the cross-arc constraint chord towards the center position of the light spot.
[0030] The process involves generating the perpendicular bisectors of the cross-arc constraint chords and obtaining a set of candidate center points based on the spatial intersection relationships between these bisectors. This aims to transform the global skeleton constraint of the contour into a direct pointing towards the center position. Although the cross-arc constraint chords do not directly contain the center coordinates, according to geometric principles, the perpendicular bisector of any chord on a circle must pass through the center. Therefore, after constructing the cross-arc constraint chords, it is necessary to generate the perpendicular bisectors corresponding to each chord and utilize the spatial intersection relationships between these bisectors as a means of detecting the center position. Since actual light spot contours often have local distortions or edge defects, the perpendicular bisectors usually do not intersect precisely at a single point, but rather form multiple intersection points around the actual center.
[0031] S104. Perform spatial density clustering on the candidate center point set, select the cluster containing the most candidate center points as the main center cluster, and determine the target spot center and location confidence based on the main center cluster.
[0032] The aforementioned spatial density clustering refers to an algorithm that groups data points based on their spatial distribution density. A candidate center cluster refers to multiple spatial clustering regions divided by the spatial density clustering algorithm from a set of candidate center points. The main center cluster is the spatial clustering region containing the most candidate center points. The target spot center is the geometric center point calculated based on the coordinates of all candidate center points within the main center cluster. Location confidence is used to quantify the reliability of the location results.
[0033] Since the perpendicular bisectors of the cross-arc constraint chords originate from different arc segments of the contour, due to edge distortion, burrs, or sampling errors, the intersection points of some perpendicular bisectors will significantly deviate from the true center, forming scattered outliers, while a large number of effective perpendicular bisectors will densely converge around the true center. Using a spatial density clustering algorithm, these spatially adjacent candidate center points can be grouped into the same candidate center cluster. Since the candidate center cluster containing the largest number of candidate center points represents the common direction of most geometric constraints, this cluster is designated as the main center cluster, effectively eliminating the interference of outliers on the positioning results. Subsequently, the arithmetic mean of the coordinates of all candidate center points within the main center cluster is calculated to obtain the target spot center; by calculating the ratio between the number of candidate points in the main center cluster and the total number of candidate center points, the positioning confidence can be obtained.
[0034] S105. Calculate the center offset based on the target spot center and the preset reference center, and determine the centering status of the laser spot based on the comparison results of the center offset and the allowable deviation threshold, as well as the comparison results of the positioning reliability and the preset reliability reference threshold.
[0035] The aforementioned preset reference center refers to a fixed reference position determined through equipment factory calibration, installation calibration, or image calibration. This fixed reference position corresponds to the geometric center of the coaxial detection area. The center offset refers to the two-dimensional spatial distance between the target spot center and the preset reference center. The allowable deviation threshold refers to the maximum acceptable offset distance preset for determining whether axis alignment is qualified. The preset reliability reference threshold refers to the minimum reliable value preset for determining whether the positional reliability reaches an acceptable level.
[0036] Comparing the center offset alone with the allowable deviation threshold can only determine whether the spot deviates from the preset reference center in geometric position, but it cannot eliminate the risk of misjudgment due to poor spot image quality or instability of the positioning algorithm itself. Positional reliability quantifies the reliability of the current center positioning result. If the positional reliability is low, it indicates severe distortion or noise interference in the spot contour. In this case, even if the center offset is within the allowable range, the positioning result may still be unreliable. Therefore, by combining offset determination with confidence verification, the spot is ultimately determined to be in a qualified centering state if the center offset meets the allowable deviation threshold and the positional reliability simultaneously meets the preset reliability reference threshold; otherwise, the spot is determined to be in an offset state or the positioning result is unreliable, and corresponding adjustment prompts or abnormal information are output. This dual determination mechanism, after obtaining the geometric positioning result of the target spot center, further verifies the reliability of the positioning result through positional reliability, effectively avoiding erroneous calibration caused by misjudgment of a single indicator, thus enabling laser axis centering calibration to achieve both high positioning accuracy and high reliability.
[0037] One possible approach is to acquire a laser spot image, perform multi-level grayscale segmentation and edge extraction on the laser spot image, and obtain the contour boundary point set of the laser spot, including: S1011. Perform grayscale conversion on the laser spot image to obtain a grayscale image.
[0038] In some embodiments, if the acquired laser spot image is a single-channel grayscale image, no grayscale conversion step is required; if the laser spot image is a multi-channel color image, a preset grayscale conversion algorithm is used to convert it into a grayscale image. The preset grayscale conversion algorithm can be a weighted average method or a maximum value method, or other grayscale conversion methods, which are not limited in this embodiment.
[0039] For example, a weighted average method is used for grayscale conversion. This involves assigning different weights to the pixel values of the red, green, and blue channels in a multi-channel color image and then summing them to obtain the final grayscale value. The example weight for the red channel is 0.299, for the green channel it's 0.587, and for the blue channel it's 0.114. The formula for calculating the grayscale value is as follows: ,in, This represents the calculated grayscale value. This represents the pixel value of the red channel in a multi-channel color image. This represents the pixel value of the green channel in a multi-channel color image. This represents the pixel value of the blue channel in a multi-channel color image.
[0040] S1012. Filter the grayscale image.
[0041] In some embodiments, when a grayscale image is obtained, a filtering operation is performed on the grayscale image to suppress high-frequency noise present during the acquisition process. In this embodiment, the filtering method may be Gaussian filtering or median filtering. For example, taking Gaussian filtering as an example, the kernel size and standard deviation are adaptively selected based on the image resolution and noise level. For instance, when the image resolution is low, the kernel size can be 3 and the standard deviation can be 0.8; when the image resolution is high, the kernel size can be 5 and the standard deviation can be 1.5. As another example, taking median filtering as an example, the window size for median filtering is adaptively determined based on the sharpness of the light spot edges and the noise intensity in the image; for instance, a 3×3 or 5×5 filtering window can be selected.
[0042] S1013. Divide the grayscale image into multiple grayscale levels according to the preset multi-level threshold segmentation algorithm, extract the interface pixels between adjacent level regions, and obtain a set of candidate edge pixels.
[0043] In some embodiments, the filtered grayscale image is segmented using multi-level thresholding to divide it into multiple grayscale level regions. The multi-threshold segmentation method can employ adaptive thresholding or multi-level Otsu's method. Specifically, the multi-level Otsu's method is used to calculate multiple layered thresholds, mapping the filtered grayscale image sequentially to the background region, edge transition region, normal spot region, and overexposed core region according to grayscale values from low to high, thus obtaining the aforementioned four grayscale levels. For example, the filtered grayscale image is divided into at least four levels: overexposed core region, normal spot region, edge transition region, and background region. By extracting the interfaces between adjacent level regions, a set of candidate edge pixels, including the spot edges, is obtained. In this way, even if the center region of the spot is saturated due to overexposure, the information of its edge transition region can still be completely preserved, alleviating the problem of edge loss in single-threshold segmentation when the spot grayscale is uneven.
[0044] S1014. Perform edge detection on the candidate edge pixel set, extract the light spot boundary, and perform contour morphology processing on the light spot boundary to obtain a closed contour. Based on the contour area, select the main boundary contour from the closed contour.
[0045] In some embodiments, given a set of candidate edge pixels, edge detection is performed on the set to accurately extract the spot boundary. Edge detection should be combined with the actual image resolution and its edge performance. For example, the Canny edge detection operator and the Sobel edge detection operator are used to extract strong boundary and detail information respectively, preserving complete edges and improving edge continuity. Furthermore, an edge detection strategy is adaptively selected based on the image resolution to improve computational efficiency. Morphological operations are performed on the output binary edge map to avoid discontinuous edge performance caused by noise or weak contrast. Subsequently, connected component analysis is performed on the binary map to extract all closed contours. The contour with the largest area is selected as the main boundary contour of the spot boundary. If multiple contours with similar areas exist, the one with the highest circularity is selected.
[0046] S1015. Perform edge positioning processing on the main boundary contour, and sort the positioned edge points to generate an ordered closed contour boundary point set composed of multiple coordinate points.
[0047] In some embodiments, edge localization processing of the main boundary contour can be performed using the gray-level moment method or interpolation. The gray-level moment method estimates the sub-pixel position of the edge point by calculating the gray-level moments of pixels within the edge region, based on the edge gray-level distribution characteristics of the gray-level image. The interpolation method can employ bilinear interpolation. Bilinear interpolation uses the gray-level values of four adjacent pixels to determine an approximate gray-level value at a certain location, thereby refining the coordinates of the edge point. Bilinear interpolation effectively improves the coordinate accuracy of edge points, obtaining sub-pixel level coordinates. For example, the neighborhood size used for interpolation is centered on the edge point. For pixel regions, by analyzing the spatial distribution of gray values within the region, high-precision sub-pixel coordinates are calculated using bilinear interpolation.
[0048] After completing the edge positioning processing of the main boundary contour, the positioned edge points are sorted. The sorting rule is to arrange them sequentially in a clockwise or counterclockwise direction, so that adjacent edge points are sequentially adjacent on the contour. If the number of edge points on the main boundary contour is... The sorted edge points are denoted as follows: , where any two adjacent points and Directly adjacent on the outline, and the last point With the first point The points connect to form a closed contour. This allows the generation of a contour boundary point set consisting of multiple coordinate points.
[0049] As one possible approach, the number of contour segments is determined based on the contour boundary point set, and the contour boundary point set is divided into multiple arc segments according to the number of contour segments. Cross-arc constraint chords are then established between non-adjacent arc segments within these multiple arc segments, including: S1021. Calculate the contour area and contour perimeter corresponding to the contour boundary point set.
[0050] The contour area refers to the size of the two-dimensional closed region enclosed by the set of contour boundary points. The contour perimeter refers to the total length of the boundary of the closed contour enclosed by the set of contour boundary points.
[0051] In some embodiments, the contour area can be obtained using methods for calculating the area of a closed polygon, such as integral calculation using a discretized form of Green's formula. Contour perimeter It is obtained by accumulating the Euclidean distances between each adjacent pixel, and the calculation formula is: The total number of coordinate points in the contour boundary point set is , Indicates the first The x-coordinate of each point in the image coordinate system Indicates the first The ordinates of points in the image coordinate system, and when Values hour, and Equivalent to the x-coordinate of the first coordinate point with the vertical axis To form a closed polygonal boundary.
[0052] S1022. Determine the contour complexity evaluation value used to characterize the regularity of the light spot shape based on the contour area and contour perimeter.
[0053] Among them, the contour complexity evaluation value refers to a numerical index constructed based on the contour area and contour perimeter, used to quantify the degree to which the regularity of the light spot shape deviates from the ideal circle.
[0054] In this embodiment of the application, by introducing a contour complexity evaluation value, the degree of light spot morphology distortion, which cannot be directly quantified, can be transformed into a numerical index that is easy to compare.
[0055] In some embodiments, the formula for calculating the contour complexity evaluation value is as follows: in, Represents the area of the outline. Indicates the perimeter of the outline. Represents pi (π). This represents the calculated contour complexity evaluation value. When the contour approaches a circle, the formula... Approaching 1, therefore Approaching 0; when the outline becomes irregular due to trailing, defects, local bulges, or irregular distortions. and The ratio is too small, making shrinking, which in turn leads to It gradually increases. Therefore, the complexity of the current light spot outline can be obtained through the above calculation formula.
[0056] S1023. Determine the number of contour segments based on the contour complexity evaluation value.
[0057] The number of contour segments refers to the total number of segments required to uniformly divide the contour boundary point set into multiple continuous arc segments according to the arc length.
[0058] Because the shape of light spot contours varies greatly in actual working conditions, using a fixed number of contour segments cannot meet the feature extraction requirements of different contour shapes. When the light spot shape is relatively regular, a smaller number of contour segments is sufficient to cover the main geometric features of the contour; however, when the light spot has obvious tailing, distortion, or local defects, it is necessary to increase the number of contour segments to improve the coverage accuracy of local features. Therefore, it is necessary to adaptively determine the number of contour segments that is appropriate for the current light spot shape based on the contour complexity evaluation value, which reflects the complexity of the light spot shape.
[0059] In some embodiments, the number of contour segments can be determined by mapping the contour complexity evaluation value to a preset value range. Specifically, a preset value range for the number of contour segments is set, for example, between 10 and 20. The contour complexity evaluation value is mapped proportionally to this preset range, and the mapping result is rounded to obtain the number of contour segments. Based on a linear proportional relationship, for example, when the contour complexity evaluation value is 0.8, the number of contour segments obtained after mapping and rounding is 18; when the contour complexity evaluation value is 0.2, the number of contour segments obtained after mapping and rounding is 12. In this way, the number of contour segments can be matched to the morphological complexity of the current spot, improving the coverage of complex contour features while effectively controlling the computational overhead caused by an excessive number of segments.
[0060] Additionally, if the number of contour segments calculated according to the above mapping rules is odd, the number of contour segments can be increased by 1 to adjust it to an even number.
[0061] S1024. Based on the number of contour segments, divide the contour boundary point set into multiple continuous arc segments using the cumulative arc length of the contour as the benchmark, and select sampling points within each continuous arc segment.
[0062] In this embodiment, the contour boundary point set is divided into multiple continuous arc segments to transform the discrete sequence of coordinate points into arc segment units with well-defined geometric boundaries. Since the contour boundary point set consists of a large number of sequentially arranged coordinate points, directly establishing connections between these points would be computationally intensive and difficult to form geometrically meaningful constraints. By dividing the contour boundary point set into multiple continuous arc segments, each arc segment corresponds to a continuous region on the contour, and the boundary relationships between arc segments can be clearly defined, thus providing a clear geometric reference for establishing cross-arc constraint chords between non-adjacent arc segments.
[0063] Selecting sampling points within each continuous arc segment aims to reduce the computational scale of subsequent geometric constraints while preserving the overall geometric features of the contour. Since each continuous arc segment contains a large number of densely packed pixel-level coordinate points, using all these points to construct constraint chords would not only result in a large computational load but also potentially lead to instability in the direction vectors of the constraint chords due to excessively small spacing between adjacent points. By selecting an appropriate number of sampling points within the arc segment as representative points, the spatial position and morphological features of the arc segment can be preserved while effectively compressing the amount of data involved in subsequent calculations, thereby improving the algorithm's efficiency.
[0064] In some embodiments, based on the number of contour segments Based on the cumulative arc length of the contour, the contour boundary point set is uniformly divided into... A series of continuous arc segments. Specifically, the starting point of the contour boundary point set is taken as the starting point of the first arc segment, and the cumulative arc length of the contour is calculated for each segment that passes through the total arc length. The length marker is used to indicate the segmentation position once, until the entire contour boundary point set is divided into... From the given arc segments, a continuous arc segment sequence is obtained. Each continuous arc segment This corresponds to a continuous region on the contour boundary. When selecting sampling points within each continuous arc segment, the number of sampling points is adaptively determined based on the arc length of each arc segment. That is, more sampling points are configured for longer arc segments, and fewer sampling points are configured for shorter arc segments, to ensure that the geometric features of each arc segment can be fully represented. The sampling points can be selected by means of equal-interval sampling, that is, representative points are selected at equal arc length intervals within the arc segment; or by means of random sampling.
[0065] S1025. Select a target arc segment from multiple continuous arc segments, and determine a pairing arc segment that is more than a preset distance threshold away from the target arc segment in the contour sequence. The pairing arc segment is the arc segment that is diametrically opposite to the target arc segment in the contour sequence.
[0066] In this embodiment, selecting the target arc segment and determining the paired arc segment is to introduce global information that reflects the overall structure of the light spot contour to suppress local interference. If constraints are only established between adjacent arc segments, when there are local trailing, burrs, or noise disturbances at the edge of the light spot, the pseudo-edge points on the adjacent arc segments will be directly coupled into the geometric constraints, causing a shift in the center positioning. By establishing pairing between spatially non-adjacent arc segments, connections can be established between different regions, thereby offsetting the influence of unilateral edge noise. Arc segments at the diametrical position, because they are located on both sides of the contour, can more comprehensively reflect the overall geometry of the contour. By setting a preset distance threshold, it is possible to quantitatively determine whether two arc segments are non-adjacent, ensuring that the paired arc segment and the target arc segment have sufficient spacing in the contour sequence, thereby establishing effective constraints across the global structure of the contour.
[0067] In some embodiments, calculating the paired arc segment index requires satisfying the diametrical positional relationship, that is, the index distance between the target arc segment and the paired arc segment on the contour sequence must be equal to half the total number of contour segments (when the number of segments is even). For example, if the number of contour segments is 10 and the target arc segment index is 3, the corresponding diametrical arc segment index is calculated as follows: add half the total number of contour segments (i.e., add 5) to the index value 3, resulting in 8. When the calculation result exceeds the total number of contour segments, the total number of contour segments needs to be subtracted to round it to the valid range. For example, if the target arc segment index is 8, the calculation result is 13, subtracting the total number of contour segments 10 yields a paired arc segment index of 3. The preset distance threshold is directly related to the total number of contour segments. When the number of contour segments is 10, the preset distance threshold can be set to be greater than or equal to 5 arc segment intervals. When the number of contour segments is odd, the number of contour segments needs to be increased by 1 to make it even before performing the above calculation process. By using the above selection and pairing methods, it can be ensured that the target arc segment and the paired arc segment are sufficiently spaced in the contour sequence.
[0068] S1026. Combine and connect the sampling points of the target arc segment with the sampling points of the paired arc segment to construct multiple cross-segment connecting lines. All cross-segment connecting lines constitute cross-arc constraint chords.
[0069] In this embodiment, after determining the target arc segment and the paired arc segment, the geometric relationship between them is transformed into a line segment structure that can be directly used to calculate the perpendicular bisector. If the arc segment pairing relationship is determined without establishing actual connecting line segments, it is impossible to further generate the perpendicular bisector and obtain the intersection point. Therefore, by combining and connecting, the sampling points on the target arc segment and the sampling points on the paired arc segment are connected one-to-one to form multiple cross-segment connecting line segments, which together constitute cross-arc constraint chords.
[0070] In some embodiments, for a pair of arc segments consisting of a target arc segment and a paired arc segment, each sampling point on the target arc segment is combined and connected with each sampling point on the paired arc segment to form a one-to-one connection relationship. When the target arc segment and the paired arc segment each have... Individual and When sampling points, each time one point is selected from the sampling point set of the target arc segment and one point is selected from the sampling point set of the paired arc segment, and these two points are connected to form a cross-segment connecting line segment. By traversing all sampling point combinations on the target arc segment and the paired arc segment in the same way, the result can be obtained from... A cross-arc constraint chord is formed by connecting line segments. Each line segment in the cross-arc constraint chord directly connects sampling points on two non-adjacent arc segments, thus spanning local areas of the contour and associating the geometric features of both sides or different segments of the contour. When the spot contour is close to a regular shape, the perpendicular bisectors corresponding to these connecting line segments will tend to converge in the same area; when there are local distortions or defects in the contour, since the cross-arc constraint chord originates from cross-regional connections between different arc segments, its overall geometric constraint relationship can still remain stable, thereby effectively suppressing the interference of local anomalies on center positioning.
[0071] S1027. Select additional arc segments within the neighborhood of the paired arc segments, pair the target arc segment with the additional arc segments to form multiple sets of cross-regional geometric constraint relationships, and combine and connect the sampling points of the target arc segment with the sampling points of the additional arc segments to construct additional cross-segment connecting segments. The cross-segment connecting segments and the additional cross-segment connecting segments together constitute cross-arc constraint chords.
[0072] After establishing the constraint relationship between the target arc segment and the paired arc segment, additional arc segments are introduced to form multiple sets of cross-regional constraint relationships to improve the geometric constraint stability under conditions of severe local contour defects. Relying solely on the single pairing relationship between the target arc segment and the paired arc segment, if the sampling point quality deteriorates due to contamination, occlusion, or distortion in the area where the paired arc segment is located, the reliability of the cross-arc constraint chord constructed based on that paired arc segment will be affected. By selecting additional arc segments within the neighborhood of the paired arc segment and establishing a pairing relationship between the target arc segment and the additional arc segment, multiple sets of cross-regional constraints can be formed. Since the additional arc segments originate from the neighboring region of the paired arc segment and have similar contour features, they can still provide effective constraint information when the paired arc segment loses its representativeness due to local defects, thereby ensuring the overall stability of the geometric constraint network.
[0073] In some embodiments, the positions of paired arc segments on the contour sequence are first determined. Additional arc segments are selected within the neighborhood of the paired arc segment; that is, at least one arc segment is selected as an additional arc segment in both the forward and backward directions along the contour sequence from the paired arc segment. The selection rules for the neighborhood range can be set according to the actual contour shape. For example, the neighborhood range can be limited to one arc segment before and after the paired arc segment, i.e., selecting two arc segments adjacent to the paired arc segment as additional arc segments. For example, when the contour shape is regular or the number of contour segments is small, one arc segment before and after the paired arc segment is selected as an additional arc segment; when the contour shape is complex or the number of contour segments is large, the neighborhood range can be extended to two or three arc segments before and after the paired arc segment. Through the above selection method, one or more additional arc segments can be obtained.
[0074] After determining the additional arc segments, the target arc segment is paired with the additional arc segments to form multiple sets of cross-regional geometric constraints. Specifically, the target arc segment is paired with each additional arc segment, forming the first set of cross-regional geometric constraints between the target arc segment and the paired arc segment, and the second and subsequent sets of cross-regional geometric constraints between the target arc segment and the additional arc segments. Subsequently, the sampling points of the target arc segment and the sampling points of the additional arc segments are combined and connected to construct multiple additional cross-segment connecting lines. The construction method of the additional cross-segment connecting lines is the same as that of the cross-segment connecting lines, that is, traversing every sampling point on the target arc segment and every sampling point on the additional arc segment, and connecting them pairwise. The cross-segment connecting lines and the additional cross-segment connecting lines together constitute a complete set of cross-arc constraint chords.
[0075] Understandably, when there are severe local defects in the light spot profile, even if the paired arc segments cannot provide effective constraints due to missing edges, the additional arc segments can still provide supplementary constraint information from the neighboring region, thereby ensuring the overall effectiveness of the geometric constraint network.
[0076] As one possible approach, the perpendicular bisector of the constraint chord spanning the arc segment is generated, and a set of candidate center points is obtained based on the spatial intersection relationship between the perpendicular bisectors, including: S1031. For each cross-arc constraint chord, determine the geometric midpoint and direction vector of the cross-arc constraint chord, and determine the perpendicular normal vector of the cross-arc constraint chord based on the direction vector.
[0077] In some embodiments, for each cross-arc constraint chord, the coordinates of its two endpoints are first obtained. Let the two endpoints of a cross-arc constraint chord be points... and points , midpoint The coordinates are ,point The coordinates are Based on the coordinates of the two points, calculate the geometric midpoint of the constraint chord spanning the arc segment, which is the arithmetic mean of the coordinates of the two endpoints. The formula for calculating the x-coordinate of the geometric midpoint is: The formula for calculating the ordinate is: Therefore, the plane coordinates of the geometric midpoint are obtained as follows: .in, Represent the x-coordinate of the midpoint of the above geometry. Represents the ordinate of the midpoint of the above geometry. Represents the midpoint of the above geometry. and Endpoints The x and y coordinates in the image coordinate system and Endpoints The x and y coordinates in the image coordinate system. This formula allows us to average the coordinates of the two endpoints, thus obtaining the position of the center of symmetry of the constraint chord spanning the arc segment.
[0078] After obtaining the geometric midpoint, the direction vector of the constraint chord spanning the arc segment is further calculated. The direction vector originates from the endpoints. coordinates minus endpoints The coordinates are obtained from the endpoints. Point to endpoint The vector is calculated using the following formula: ,in, This represents the direction vector mentioned above. In a two-dimensional plane, it is related to the direction vector... A perpendicular vector is also called a perpendicular normal vector. Since the condition for two vectors to be perpendicular is that their dot product is zero, the direction vectors can be... The components are swapped and inverted to obtain the perpendicular normal vector, i.e. ,in, This represents the aforementioned vertical normal vector.
[0079] S1032. Starting from the geometric midpoint, extend the perpendicular bisector of each arc segment constraint chord to both sides by a preset extension distance along the vertical normal vector.
[0080] After obtaining the geometric midpoint, direction vector, and perpendicular normal vector of each cross-arc constraint chord, these parameters are converted into geometric lines that can actually participate in intersection calculations in two-dimensional space, namely, the perpendicular bisectors. The geometric midpoint determines the reference position through which the perpendicular bisector passes, and the perpendicular normal vector determines the direction of extension of the perpendicular bisector. By extending a predetermined distance to both sides along the perpendicular normal vector from the geometric midpoint as the starting point, the perpendicular bisector corresponding to each cross-arc constraint chord can be generated.
[0081] In some embodiments, the magnitude of the vertical normal vector is first obtained, that is, the length of the vertical normal vector on the two-dimensional plane. Dividing the vertical normal vector by its own magnitude yields the unit direction vector corresponding to the vertical normal vector. The unit direction vector retains the direction information of the vertical normal vector, and its length is 1, facilitating equidistant extension calculations. Subsequently, starting from the geometric midpoint, a preset extension distance is extended along both the positive and negative directions of the unit direction vector. The preset extension distance is determined by the maximum circumscribed diameter of the current contour boundary point set, ensuring that the extended perpendicular bisector can cover the interior of the light spot contour and any possible central regions near the edges. In an exemplary value, the extension distance can be set to 1.0 to 1.5 times the maximum circumscribed diameter of the contour. Through the above extension operation, the perpendicular bisector corresponding to each cross-arc constraint chord can be generated.
[0082] S1033. Eliminate pairs of perpendicular bisectors with an angle smaller than the preset angle threshold, perform spatial intersection calculation on the remaining perpendicular bisector combinations, and retain the intersection points located within the area enclosed by the contour boundary point set or within the effective analysis range as candidate center points. The candidate center point set is composed of all candidate center points.
[0083] In this embodiment, after generating a large number of perpendicular bisectors, not all combinations of perpendicular bisectors can produce valid intersections. When the angle between two perpendicular bisectors is too small, they tend to be parallel, and the solution for their intersection is prone to numerical divergence, resulting in drift points far from the true center of the circle. These points can interfere with clustering. Therefore, it is necessary to first remove pairs of perpendicular bisector combinations with an angle smaller than a preset angle threshold before calculating the intersection, in order to avoid introducing numerically unstable intersections into the candidate center point set. The setting of the preset angle threshold needs to balance the retention of valid intersections and the exclusion of outliers. In an exemplary value, the preset angle threshold can be set to 15 degrees. The above preset angle threshold can be determined based on the empirical value of the minimum angle required for two perpendicular bisectors to produce a valid intersection. For combinations of perpendicular bisectors with an angle greater than or equal to the preset angle threshold, a spatial intersection calculation operation is performed, that is, the coordinates of the intersection point of the two lines on the two-dimensional plane are calculated. Since the perpendicular bisectors of different contour regions will produce a large number of intersections when they intersect, some of these intersections may be located outside the light spot contour and are invalid intersection information. Therefore, further screening is needed to retain only the intersection points located within the area enclosed by the contour boundary point set or within the effective analysis range as candidate center points.
[0084] In some embodiments, all perpendicular bisector combinations are traversed, and the included angle of each pair of perpendicular bisectors is calculated. The included angle of the perpendicular bisectors can be obtained by calculating the angle between the direction vectors of the two lines, i.e., by using the vector dot product formula to calculate the cosine of the included angle, and thus obtaining the size of the included angle. Perpendicular bisector combinations with included angles less than a preset included angle threshold are marked as invalid combinations and are not included in the intersection operation. For perpendicular bisector combinations with included angles greater than or equal to the preset included angle threshold, a spatial intersection operation is performed, i.e., the equations of the two perpendicular bisectors are solved simultaneously, and the coordinates of their intersection point are obtained. After solving for the coordinates of the intersection point, it is determined whether the intersection point is located within the area enclosed by the contour boundary point set or within the effective analysis range. The aforementioned effective analysis range refers to the area formed by expanding outward by a preset proportion based on the contour center area. The preset proportion of the effective analysis range can be set according to the overall size of the contour. In an exemplary value, the preset proportion can be set to a range of 10% to 20% outward from the contour center area. The determination method is as follows: Calculate the positional relationship between the intersection point coordinates and the polygon formed by the contour boundary point set. If the intersection point is located inside the closed polygon or within the effective analysis range, then the intersection point is retained as a candidate center point. After traversing all effective perpendicular bisector combinations, a candidate center point set is formed from all retained candidate center points. This candidate center point set reflects the common direction of a large number of cross-arc constraint chords towards the center position of the light spot. Since the candidate center point set originates from the geometric constraint relationships between multiple non-adjacent regions, its spatial distribution can reflect the common direction of the overall contour structure towards the center position. Even if there are local distortions or defects, the overall distribution trend can remain stable.
[0085] As one possible approach, spatial density clustering is performed on the candidate center point set, and the cluster containing the largest number of candidate center points is selected as the master center cluster. The target spot center and location confidence are then determined based on the master center cluster, including: S1041. Perform a preset density clustering algorithm on the candidate center point set to obtain multiple candidate center clusters, and determine the candidate center cluster with the most candidate center points as the main center cluster.
[0086] When the perpendicular bisectors of different cross-arc constraint chords intersect in space, they are affected by local distortions, burrs, or sampling errors at the contour edges. Some intersection points of these perpendicular bisectors deviate from the true center, forming scattered outliers. Meanwhile, most effective perpendicular bisectors converge densely near the true center, forming spatial clusters. Although the candidate center point set reflects the common direction of each perpendicular bisector towards the center, the scattered outliers, if not distinguished, will directly interfere with the determination of the true center region. Therefore, a pre-defined density clustering algorithm is needed to process the candidate center point set to identify spatially adjacent clusters from a large number of discrete intersection points, thereby separating effective intersections from outliers.
[0087] In some embodiments, a preset density clustering algorithm is performed on the candidate centroid set. This preset density clustering algorithm can cluster based on spatial neighborhood density, such as a density-based clustering algorithm. This algorithm groups spatially connected candidate centroids into the same candidate centroid cluster by setting two parameters: neighborhood radius and minimum sample size. Specifically, the density-based clustering algorithm calculates the number of neighboring points contained within the neighborhood radius of each candidate centroid. If the number of neighboring points reaches the minimum sample size, the centroid and its neighboring points are grouped into the same candidate centroid cluster, and this process is continuously expanded until clustering of all candidate centroids is completed. In exemplary cases, the neighborhood radius can be set according to the overall spatial distribution range of the candidate centroid set, for example, 5% to 15% of the spatial distribution range; the minimum sample size can be set according to the total number of candidate centroids, for example, a certain percentage of the total number, such as 5% to 10% of the total number of candidate centroids. Through this preset density clustering algorithm, the candidate centroid set is divided into multiple candidate centroid clusters. After obtaining multiple candidate center clusters, the number of candidate center points contained in each cluster is counted, and the candidate center cluster with the most candidate center points is determined as the master center cluster. When multiple candidate center clusters have the same number of candidate center points, the variance of the distribution of candidate center points within each cluster is calculated, and the candidate center cluster with the smallest variance is determined as the master center cluster. Since the perpendicular bisectors of most geometric constraint chords should ideally intersect near the true center of the circle, the master center cluster with the most candidate points represents the greatest consensus on geometric constraints, and its corresponding region is the most likely true spot center location. This suppresses the interference of local abnormal edges, contour defects, and outliers on the localization results.
[0088] S1042. Calculate the arithmetic mean of the coordinates of all candidate center points in the main center cluster, and use it as the center of the target spot.
[0089] After the main center cluster is determined, it contains multiple candidate center points. Although these candidate center points are clustered near the true center, they do not completely overlap but are spatially scattered. If any candidate center point within the main center cluster is directly selected as the target spot center, its positional accuracy is limited by the individual deviation of that point and cannot fully reflect the common orientation of multiple geometric constraints. Therefore, it is necessary to calculate the arithmetic mean of the coordinates of all candidate center points in the main center cluster to average the positional information of multiple candidate center points, thereby obtaining a central position that integrates all effective geometric constraint information. This position is the target spot center.
[0090] In some embodiments, the main central cluster contains The candidate center points, of which the first The coordinates of the candidate center points are , The value ranges from 1 to .like If the value equals 0, clustering is considered a failure, and a location failure message is output; otherwise, the arithmetic mean of the coordinates of all candidate center points in the main center cluster is calculated as the target spot center. The x-coordinate of the target spot center is... and ordinate The calculation formulas are as follows: in, This represents the total number of candidate centroids contained in the main centroid cluster. Indicates the first The x-coordinates of the candidate center points in the image coordinate system Indicates the first The ordinates of the candidate center points in the image coordinate system This represents the calculated x-coordinate of the target spot center. This represents the calculated ordinate of the target spot center. Using the arithmetic mean calculation formula described above, the arithmetic mean of the coordinates of all candidate center points within the main center cluster can be used as the final target spot center. This effectively eliminates the slight offset caused by the intersection error of the perpendicular bisectors of individual candidate center points, outputting a stable and accurate target spot center coordinate.
[0091] S1043. Calculate the ratio of the number of candidate centroids in the main centroid cluster to the total number of candidate centroids in the candidate centroid set. Use the ratio as the location confidence, which is used to characterize the degree to which candidate centroids converge towards a single centroid region.
[0092] Since the main center cluster originates from the region containing the most candidate points after spatial density clustering, the higher the proportion of its candidate points to the total number of candidate points, the more perpendicular bisector intersections converge in that region. Therefore, by calculating this ratio, the consistency of geometric constraints can be converted into a quantifiable confidence index, allowing the system to determine the reliability of the positioning result while outputting the center coordinates.
[0093] In some embodiments, the total number of candidate center points in the candidate center point set is obtained. .like If the value is 0, it indicates that no valid intersection points were generated. In this case, the centering confidence is forcibly assigned a value of 0, and the centering is deemed invalid. If it is greater than 0, then according to and The location reliability is obtained, and the formula for calculating the location reliability is as follows: .in, This represents the total number of candidate centroids in the candidate centroid set. This represents the calculated location reliability. Location reliability The value ranges from 0 to 1. The closer it is to 1, the more geometric constraints point to the same central region, and the more reliable the positioning result is; The smaller the value, the greater the uncertainty in the current contour, and the less reliable the positioning result.
[0094] In the example values, the preset reliability reference threshold can be set to 0.6. When the location reliability is greater than the preset reliability reference threshold, the current center positioning result is determined to be valid, and the center coordinates of the target spot are output. When the location reliability is less than or equal to the preset reliability reference threshold, the current center positioning result is determined to be unreliable. At this time, the system can perform correction operations such as re-segmentation, resampling, and re-clustering, or output spot anomaly prompts to the operator to avoid abnormal contours affecting subsequent axis alignment determination results.
[0095] As one possible approach, the center offset is calculated based on the target spot center and a preset reference center. Then, based on a comparison of the center offset with an allowable deviation threshold, the alignment status of the laser spot is determined, including: S1051. Calculate the horizontal and vertical offsets between the center of the target spot and the preset reference center, and determine the center offset based on the horizontal and vertical offsets.
[0096] In this embodiment, after obtaining the center of the target light spot, it is compared with a preset reference center to determine whether the current light spot is in the aligned position. Comparing the difference in the horizontal or vertical directions alone only reflects the deviation in a single direction and cannot fully describe the overall offset of the light spot in two-dimensional space. Therefore, it is necessary to first calculate the horizontal and vertical offsets separately, and then calculate the comprehensive center offset based on these two components to comprehensively assess the degree of deviation of the light spot relative to the preset reference center.
[0097] In some embodiments, the position coordinates of a preset reference center and the position coordinates of the target spot center are obtained simultaneously. The horizontal offset is obtained by calculating the coordinate difference between the target spot center and the preset reference center in the horizontal direction; the vertical offset is obtained by calculating the coordinate difference between the target spot center and the preset reference center in the vertical direction. The positive or negative value of the horizontal offset reflects the direction of the spot's horizontal offset (positive value indicates offset to the right, negative value indicates offset to the left); the positive or negative value of the vertical offset reflects the direction of the spot's vertical offset (positive value indicates offset upward, negative value indicates offset downward).
[0098] After obtaining the horizontal and vertical offsets, the center offset is determined based on these offsets. The center offset refers to the combined spatial offset distance of the target spot center relative to a preset reference center, calculated as the Euclidean distance in two-dimensional space based on the horizontal and vertical offsets. The center offset integrates the offset information of the spot in both horizontal and vertical directions into a single value. In some embodiments, a preset pixel equivalent (e.g., 0.1 mm / pixel) is pre-stored or obtained through camera calibration. This preset pixel equivalent is used to establish the conversion ratio between pixel distance in the image coordinate system and physical space size. Multiplying the calculated center offset (in pixels) by the preset pixel equivalent yields the center offset in units of physical distance.
[0099] S1052. When the center offset is less than or equal to the allowable deviation threshold, the laser spot is determined to be in a qualified centering state.
[0100] After calculating the center offset, it is compared with an objective criterion to determine whether the current spot meets the alignment requirements. The center offset itself only reflects the magnitude of the spot's deviation from the preset reference center. Without an allowable deviation threshold as a reference, it is impossible to determine whether the offset is within the allowable range, and therefore, a conclusion on whether it is qualified or not cannot be given. Therefore, by comparing the center offset with the allowable deviation threshold, the quantitatively calculated offset result can be transformed into an executable judgment conclusion.
[0101] In this embodiment, the setting of the allowable deviation threshold must be closely related to the actual precision requirements of the laser processing equipment. The determination of this threshold can be, but is not limited to, the following: obtained through statistical analysis of precision calibration tests before the equipment leaves the factory, for example, determined by statistical distribution based on the offset data of multiple known qualified alignment samples; or manually entered and set by on-site operators according to the current processing precision level requirements. In exemplary values, the allowable deviation threshold can be differentiated according to the equipment's functional type; for example, for high-precision laser cutting equipment, it can be set to 0.05 mm; for conventional laser welding equipment, it can be set to 0.1 mm. The above values can be dynamically adjusted according to actual process requirements.
[0102] Through the above judgment operation, the judgment conclusion of the axis alignment status can be output in a timely manner after the center offset is obtained, providing clear qualified indications for operators or automatic calibration systems, and ensuring that the laser processing equipment operates in a state that meets the accuracy requirements.
[0103] S1053. When the center offset is greater than the allowable deviation threshold, the laser spot is determined to be in an offset state, and adjustment prompt information is generated according to the signs of the horizontal and vertical offsets.
[0104] In some embodiments, when the center offset is greater than the allowable deviation threshold, the values of the horizontal and vertical offsets are first read. The horizontal offset value determines the direction of the light spot's horizontal offset: if the horizontal offset is greater than zero, the light spot is determined to be offset to the right relative to the preset reference center; if the horizontal offset is less than zero, the light spot is determined to be offset to the left relative to the preset reference center. The vertical offset value determines the direction of the light spot's vertical offset: if the vertical offset is greater than zero, the light spot is determined to be offset upwards relative to the preset reference center; if the vertical offset is less than zero, the light spot is determined to be offset downwards relative to the preset reference center. By combining the signs of the horizontal and vertical offsets, the overall offset direction of the light spot in the two-dimensional plane can be determined.
[0105] After determining the offset direction, adjustment prompts are generated. These prompts can be text-based instructions for the operator, such as "Please adjust the machining head to the left" or "Please adjust the machining head downwards," or they can be command signals communicating with the automatic adjustment mechanism, such as transmitting the sign and value of the horizontal and vertical offset as adjustment parameters to the electric displacement table or servo motor. Through this process, clear and complete adjustment guidelines regarding the offset direction and degree are provided to the operator or the automatic adjustment mechanism, enabling rapid completion of subsequent axis alignment and calibration operations.
[0106] like Figure 2 The diagram shows a schematic of a laser axis alignment device 20 based on intelligent vision. The laser axis alignment device 20 based on intelligent vision includes: an image acquisition and contour extraction unit 21, a contour segmentation and constraint construction unit 22, a center calculation unit 23, and an alignment determination unit 24.
[0107] The image acquisition and contour extraction unit 21 is used to acquire a laser spot image, perform multi-level grayscale segmentation and edge extraction on the laser spot image, and obtain the contour boundary point set of the laser spot. The specific processing method performed by the image acquisition and contour extraction unit 21 can be referred to the detailed description of S101, S1011 to S1015 above, and will not be repeated here.
[0108] The contour segmentation and constraint construction unit 22 is used to determine the number of contour segments based on the contour boundary point set, and divide the contour boundary point set into multiple arc segments according to the number of contour segments. Cross-arc constraint chords are then established between non-adjacent arc segments within these multiple arc segments. The specific processing method performed by the contour segmentation and constraint construction unit 22 can be found in the detailed description of S102 and its sub-steps S1021 to S1027 above, and will not be repeated here.
[0109] The central calculation unit 23 is used to generate the perpendicular bisector of the constraint chord across the arc segment. Based on the spatial intersection relationship between the perpendicular bisectors, it obtains a set of candidate center points, performs spatial density clustering on the candidate center point set, selects the cluster containing the most candidate center points as the main center cluster, and determines the target spot center and location confidence based on the main center cluster. The specific processing method performed by the central calculation unit 23 can be referred to the detailed description of S103 and its sub-steps S1031 to S1033 above, and will not be repeated here.
[0110] The centering determination unit 24 is used to calculate the center offset based on the target spot center and the preset reference center, and to determine the centering status of the laser spot based on the comparison result of the center offset with the allowable deviation threshold and the comparison result of the positioning reliability with the preset reliability reference threshold. The specific processing method performed by the centering determination unit 24 can be referred to in the detailed description of S104, S105 and its sub-steps S1041 to S1053 above, and will not be repeated here.
[0111] Please see Figure 3 The diagram illustrates a system architecture of a laser axis alignment system 300 based on intelligent vision, according to an embodiment of this application. The system includes a laser axis alignment device 20, an image acquisition module 30, and a result output module 40. The units communicate bidirectionally via a communication link, ensuring real-time interaction of acquired data and analysis results. The communication link can employ wired or wireless transmission to meet the communication needs of different monitoring scenarios.
[0112] The image acquisition module 30 is used to acquire laser spot images and transmit them to the image acquisition and contour extraction unit.
[0113] The result output module 40 is used to output the result information obtained by the centering determination unit. The result information includes the centering status, adjustment prompt information, and spot abnormality prompt information.
Claims
1. A laser axis alignment method based on intelligent vision, characterized in that, include: Acquire a laser spot image, perform multi-level grayscale segmentation and edge extraction on the laser spot image, and obtain the contour boundary point set of the laser spot; The number of contour segments is determined based on the set of contour boundary points, and the set of contour boundary points is divided into multiple arc segments according to the number of contour segments. Cross-arc constraint chords are established between non-adjacent arc segments in the multiple arc segments, and the perpendicular bisectors of the cross-arc constraint chords are generated. Based on the spatial intersection relationship between the perpendicular bisectors, a set of candidate center points is obtained. Spatial density clustering is performed on the candidate center point set, and the cluster containing the most candidate center points is selected as the main center cluster. The target spot center and the location confidence are determined based on the main center cluster. The center offset is calculated based on the target spot center and the preset reference center. The center offset is compared with the allowable deviation threshold, and the positioning confidence is compared with the preset confidence reference threshold to determine the centering status of the laser spot.
2. The laser axis alignment method based on intelligent vision according to claim 1, characterized in that, The process of acquiring a laser spot image, performing multi-level grayscale segmentation and edge extraction on the laser spot image to obtain the contour boundary point set of the laser spot, includes: The laser spot image is converted to grayscale to obtain a grayscale image; The grayscale image is filtered. The grayscale image is divided into multiple grayscale levels according to a preset multi-level threshold segmentation algorithm, and the interface pixels between adjacent level regions are extracted to obtain a set of candidate edge pixels. Edge detection is performed on the candidate edge pixel set to extract the spot boundary, and the spot boundary is processed to obtain a closed contour. The main boundary contour is then selected from the closed contour based on the contour area. The main boundary contour is processed for edge localization, and the localized edge points are sorted to generate an ordered closed set of the contour boundary points consisting of multiple coordinate points.
3. The laser axis alignment method based on intelligent vision according to claim 1, characterized in that, The step of determining the number of contour segments based on the contour boundary point set, dividing the contour boundary point set into multiple arc segments according to the number of contour segments, and establishing cross-arc constraint chords between non-adjacent arc segments in the multiple arc segments includes: Calculate the contour area and contour perimeter corresponding to the set of contour boundary points; The contour complexity evaluation value used to characterize the regularity of the light spot shape is determined based on the contour area and the contour perimeter. The number of contour segments is determined based on the contour complexity evaluation value; Based on the number of contour segments, the contour boundary point set is divided into multiple continuous arc segments with the cumulative arc length of the contour as the benchmark, and sampling points are selected in each of the continuous arc segments. Select a target arc segment from the plurality of continuous arc segments, and determine a pairing arc segment that is more than a preset distance threshold apart from the target arc segment in the contour sequence. The pairing arc segment is the arc segment that is diametrically opposite to the target arc segment in the contour sequence. The sampling points of the target arc segment are combined and connected with the sampling points of the paired arc segment to construct multiple cross-segment connecting lines. All the cross-segment connecting lines constitute the cross-arc segment constraint chord. Additional arc segments are selected within the neighborhood of the paired arc segments. The target arc segment is paired with the additional arc segments to form multiple sets of cross-regional geometric constraint relationships. The sampling points of the target arc segment and the sampling points of the additional arc segments are combined and connected to construct additional cross-segment connecting lines. The cross-segment connecting lines and the additional cross-segment connecting lines together constitute the cross-arc constraint chord.
4. The laser axis alignment method based on intelligent vision according to claim 1, characterized in that, The process of generating the perpendicular bisector of the cross-arc constraint chord, and obtaining a set of candidate center points based on the spatial intersection relationship between the perpendicular bisectors, includes: For each of the aforementioned cross-arc constraint chords, determine the geometric midpoint and direction vector of the cross-arc constraint chord, and determine the perpendicular normal vector of the cross-arc constraint chord based on the direction vector; Starting from the geometric midpoint, extend a preset distance to both sides along the vertical normal vector to generate the perpendicular bisectors corresponding to each of the cross-arc constraint chords. Eliminate pairs of perpendicular bisectors with an angle less than a preset angle threshold, perform spatial intersection calculations on the remaining perpendicular bisector combinations, and retain the intersection points located within the area enclosed by the contour boundary point set or within the effective analysis range as candidate center points. The candidate center point set is composed of all the candidate center points.
5. The laser axis alignment method based on intelligent vision according to claim 1, characterized in that, The step of performing spatial density clustering on the candidate center point set, selecting the cluster containing the most candidate center points as the master center cluster, and determining the target spot center and location confidence based on the master center cluster includes: A preset density clustering algorithm is performed on the candidate center point set to obtain multiple candidate center clusters. The candidate center cluster containing the most candidate center points is determined as the main center cluster. Calculate the arithmetic mean of the coordinates of all candidate center points in the main center cluster, and use it as the center of the target spot; The ratio of the number of candidate centroids in the main centroid cluster to the total number of candidate centroids in the candidate centroid set is calculated, and the ratio is used as the location confidence, which is used to characterize the degree to which candidate centroids converge towards a single central region.
6. The laser axis alignment method based on intelligent vision according to claim 5, characterized in that, The step of calculating the center offset based on the target spot center and the preset reference center, and determining the centering state of the laser spot based on the comparison result of the center offset and the allowable deviation threshold, includes: Calculate the horizontal and vertical offsets between the center of the target spot and the preset reference center, and determine the center offset based on the horizontal and vertical offsets; When the center offset is less than or equal to the allowable deviation threshold, the laser spot is determined to be in a qualified centering state; When the center offset is greater than the allowable deviation threshold, the laser spot is determined to be in an offset state, and an adjustment prompt message is generated based on the signs of the horizontal and vertical offsets.
7. The laser axis alignment method based on intelligent vision according to claim 5, characterized in that, The method further includes: The location confidence is compared with the preset confidence reference threshold. When the location confidence is less than the preset confidence reference threshold, at least one of the following correction operations is performed: re-divide the arc segments based on the current contour boundary point set to reconstruct the cross-arc constraint chords; re-select sampling points in each arc segment to construct a new set of cross-arc constraint chords; re-perform spatial density clustering to obtain a new main center cluster; or, output spot anomaly prompt information.
8. The laser axis alignment method based on intelligent vision according to claim 1, characterized in that, The preset reference center is determined by factory calibration, installation calibration or image calibration. The preset reference center corresponds to the geometric center position of the coaxial detection area, and the preset reference center does not change during the detection process.
9. A laser axis alignment device based on intelligent vision, characterized in that, include: The image acquisition and contour extraction unit is used to acquire a laser spot image, perform multi-level grayscale segmentation and edge extraction on the laser spot image, and obtain the contour boundary point set of the laser spot. The contour segmentation and constraint construction unit is used to determine the number of contour segments based on the contour boundary point set, divide the contour boundary point set into multiple arc segments according to the number of contour segments, and establish cross-arc segment constraint chords between non-adjacent arc segments in the multiple arc segments. The central calculation unit is used to generate the perpendicular bisector of the cross-arc constraint chord, obtain a set of candidate center points based on the spatial intersection relationship between the perpendicular bisectors, perform spatial density clustering on the set of candidate center points, select the cluster containing the most candidate center points as the main center cluster, and determine the target spot center and location confidence based on the main center cluster. The centering determination unit is used to calculate the center offset based on the center of the target spot and the preset reference center, and to determine the centering status of the laser spot based on the comparison result of the center offset and the allowable deviation threshold, and the comparison result of the positioning confidence and the preset confidence reference threshold.
10. A laser axis alignment system based on intelligent vision, characterized in that, Including the laser axis alignment device based on intelligent vision as described in claim 9; The laser axis alignment system based on intelligent vision also includes an image acquisition module and a result output module. The image acquisition module is used to acquire laser spot images and transmit them to the image acquisition and contour extraction unit. The result output module is used to output the result information obtained by the centering determination unit. The result information includes the centering status, adjustment prompt information, and light spot abnormality prompt information.