A lap joint correction method and system based on double galvanometer and machine vision

CN122928984APending Publication Date: 2026-10-16WUHAN LUOJIA INTELLIGENT TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611030687.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-12
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

但是上述方案在执行标定时需要采集多姿态棋盘格图像并进行复杂的K近邻与主成分分析计算,算法流程长且计算量大,导致整体标定效率较低,不适合SLM设备现场快速完成双振镜搭接校准的需求

Benefits of technology

(1)通过原始图像预处理与骨架化、十字轮廓筛选和质心计算,结合基于行列索引的亚像素线条中心检测,将十字中心坐标的提取精度提升到亚像素级,采用基于法向量角度的聚类和RANSAC直线拟合,有效抑制噪声点、瑕疵和局部变形的干扰,保证十字中心求取的稳定性和鲁棒性,并且利用十字中心坐标与理论中心坐标的对比,精确求得待校准振镜的坐标误差,实现对振镜扫描坐标系的高精度标定与补偿,可有效消除振镜安装误差、光学畸变以及系统几何误差等带来的定位偏差,显著提升单振镜扫描定位精度与重复精度,同时通过基准振镜与另一待校准振镜以棋盘格交错方式同时打印两套十字阵列,构建双振镜在同一物理平面上的公共特征集,进而精确求取搭接参数,搭接参数导入SLM设备后,可对两振镜的坐标关系进行统一标定和补偿,实现搭接区域的高精度重合,从而显著提升双振镜搭接的标定校正效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122928984A_ABST
    Figure CN122928984A_ABST
Patent Text Reader

Abstract

The application provides a lap joint correction method and system based on a double galvanometer and machine vision, and relates to the technical field of device debugging and calibration. The method comprises the following steps: controlling a to-be-calibrated galvanometer to print a cross mark array on a calibration plate, collecting an original image, pre-processing the original image, and obtaining a skeleton image; performing cross contour screening on the skeleton image, calculating the centroid coordinates and row and column indexes of each cross mark; performing sub-pixel line center detection on each cross mark, constructing a sub-pixel center point set, separating the sub-pixel center point set into a horizontal line point set and a vertical line point set based on a clustering algorithm, and performing straight line fitting to obtain cross center coordinates; calculating coordinate errors according to the cross center coordinates and theoretical center coordinates, calibrating the to-be-calibrated galvanometer according to the coordinate errors, and obtaining a reference galvanometer; controlling the reference galvanometer and the to-be-calibrated galvanometer to simultaneously print two sets of cross mark arrays on the calibration plate in a chessboard interlaced manner, and calculating lap joint parameters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of equipment debugging and calibration technology, and in particular to a method and system for overlap correction based on dual galvanometers and machine vision. Background Technology

[0002] Selective laser melting (SLM) technology, as a mainstream metal additive manufacturing method, has been widely used in the direct forming of key components in aerospace, medical devices, mold manufacturing, and other fields. Its forming accuracy and efficiency directly determine the quality and production cost of the final part. Currently, large-size SLM equipment generally adopts a dual-galvanometer scanning system to expand the forming area. Two galvanometers are each responsible for a part of the area and are spliced ​​together in an overlapping manner to achieve the complete printing of large-size parts.

[0003] Chinese patent CN121685667B discloses a planar calibration method for cross-shaped structured light. This method includes: first, segmenting the laser line image into laser stripes and a background; then, using an image thinning algorithm to extract the center line of the laser stripes from each segmented laser line image, achieving accurate extraction of the laser stripe center line; and finally, constructing a classification criterion based on K-nearest neighbor principal component analysis and normal vector consistency, which can quickly and accurately determine whether the laser points on the laser stripe center line belong to the first laser plane or the second laser plane. However, the above scheme requires acquiring multi-pose checkerboard images and performing complex K-nearest neighbor and principal component analysis calculations during calibration. The algorithm is lengthy and computationally intensive, resulting in low overall calibration efficiency, which is unsuitable for the need for rapid on-site calibration of dual galvanometer overlap using SLM equipment. Therefore, it is essential to provide a method and system for overlap correction based on dual galvanometers and machine vision to improve the calibration efficiency of dual galvanometer overlap. Summary of the Invention

[0004] In view of this, the present invention proposes a method and system for overlapping correction based on dual galvanometers and machine vision, which helps to improve the calibration and correction efficiency of dual galvanometer overlapping.

[0005] This invention provides a method for overlap correction based on dual galvanometers and machine vision, the method comprising: Control any galvanometer to be calibrated in the SLM device to print a cross mark array on the calibration board, acquire the original image corresponding to the cross mark array, and preprocess the original image to obtain a skeletonized image; The skeletonized image is subjected to cross contour filtering to obtain all cross marks in the skeletonized image. The centroid coordinates corresponding to each cross mark are calculated, and the row and column indexes of each cross mark are constructed based on the centroid coordinates. Based on the row and column index, sub-pixel line center detection is performed on each cross mark to construct a sub-pixel center point set. A clustering algorithm based on normal vector angle separates the sub-pixel center point set into a horizontal line point set and a vertical line point set. The horizontal line point set and the vertical line point set are then fitted with a straight line using a random sample consensus algorithm to obtain the cross center coordinates corresponding to the cross mark. The coordinate error of the galvanometer to be calibrated is calculated based on the coordinates of the crosshair center and the theoretical center coordinates corresponding to the galvanometer to be calibrated, and the galvanometer to be calibrated is calibrated using the coordinate error to obtain a reference galvanometer. The reference galvanometer and another galvanometer to be calibrated in the SLM device are controlled to simultaneously print two sets of cross mark arrays on the calibration board in a checkerboard pattern, and the overlap parameters corresponding to the two sets of cross mark arrays are calculated. The overlap parameters are then imported into the SLM device to complete the dual galvanometer overlap calibration.

[0006] Based on the above technical solutions, preferably, the preprocessing of the original image to obtain a skeletonized image specifically includes: Convert the original image corresponding to the crosshair array captured by the industrial camera into a grayscale image; The grayscale image is denoised by Gaussian filtering, and the denoised grayscale image is superimposed with the Laplacian response with a preset weight to obtain a sharpened image. A bilateral filter is applied to the sharpened image, and the Otsu method is used to adaptively binarize the bilaterally filtered sharpened image to obtain a binary image in which the cross-marked region is separated from the background. A morphological closing operation is performed on the binary image, and a skeletonization operation is performed on the binary image after the closing operation, so as to refine the multi-pixel-width cross lines in the binary image into single-pixel-width skeleton lines to obtain the skeletonized image.

[0007] Based on the above technical solutions, preferably, the step of performing cross-shaped contour filtering on the skeletonized image to obtain all cross-shaped marks in the skeletonized image specifically includes: Contour extraction is performed on the skeletonized image to obtain a first cross-shaped contour set; Calculate the arc length of each cross contour in the first cross contour set, and remove cross contours with an arc length less than a first preset threshold to obtain a second cross contour set. Calculate the area of ​​each cross contour in the second cross contour set, and remove cross contours with an area greater than a second preset threshold to obtain a third cross contour set. Calculate the aspect ratio of the bounding rectangle of each cross contour in the third cross contour set, and retain only the cross contours whose aspect ratio is within a preset range, so as to determine the cross contour as the cross mark in the skeletonized image.

[0008] More preferably, the step of performing sub-pixel line center detection on each cross mark based on the row and column index to construct a sub-pixel center point set specifically includes: Based on the skeletonized image, the cross mark is morphologically dilated, and the dilation radius is determined according to the Gaussian smoothing scale parameter to generate a region of interest mask limited to the periphery of the cross mark. Gray-level candidate pixels are selected based on the preset relationship between local mean and standard deviation. The local detection window is clipped based on the centroid coordinates of each cross mark and the row and column index corresponding to the cross mark. Within the local detection window and the region of interest mask, the Gaussian smoothing scale is determined by using a preset local line width. The first and second partial derivatives are calculated for the gray-level candidate pixels to construct the Hessian matrix corresponding to the gray-level candidate pixels. The eigenvector corresponding to the eigenvalue with the largest absolute value in the Hessian matrix is ​​used as the line normal vector. A second-order Taylor expansion is performed on the line normal vector and the grayscale candidate pixels to obtain the sub-pixel center coordinates that satisfy the preset offset constraint conditions. The sub-pixel center coordinates corresponding to each cross mark are summarized to construct a set of sub-pixel center points.

[0009] More preferably, the clustering algorithm based on normal vector angle separates the sub-pixel center point set into a horizontal line point set and a vertical line point set, specifically including: Based on the normal vector of each sub-pixel center point in the set of sub-pixel center points, the orientation angle feature of the sub-pixel center point is calculated, and the orientation angle corresponding to the orientation angle feature is limited to a preset angle range. The orientation angle features of all sub-pixel center points are used as one-dimensional clustering features and input into the clustering algorithm. The sub-pixel center points are automatically grouped based on orientation angle similarity and point density. A group of points whose orientation angles are clustered within a first angle range is classified as a horizontal line point set, and a group of points whose orientation angles are clustered within a second angle range is classified as a vertical line point set.

[0010] More preferably, the step of performing line fitting on the horizontal line point set and the vertical line point set using a random sample consensus algorithm to obtain the cross center coordinates corresponding to the cross mark specifically includes: For each set of horizontal line points corresponding to a cross mark, the first inner point is randomly selected multiple times using the random sample consensus algorithm, and a candidate horizontal line model is established. The candidate horizontal line with the largest number of first inner points and the smallest residual is selected as the horizontal line of the cross mark. For each set of vertical line points corresponding to a cross mark, the random sample consensus algorithm is used to randomly select the second inner point multiple times and establish a candidate vertical line model. The candidate vertical line with the largest number of first inner points and the smallest residual is selected as the vertical line of the cross mark. Find the intersection point by combining the horizontal line and the vertical line, and use the coordinates of the intersection point as the coordinates of the center of the cross mark.

[0011] More preferably, the calculation of the overlap parameters corresponding to the two sets of cross-marker arrays specifically includes: Based on the cross center coordinates of the reference galvanometer and another galvanometer to be calibrated in the two sets of cross mark arrays printed, respectively, the cross center coordinates of each row or column are fitted with a straight line to obtain the main direction vectors of the two sets of cross mark arrays in the row and column directions, and the rotational deviation between the two sets of cross mark arrays is calculated by the angle between the main direction vectors. Based on the ratio of the distance between the row endpoints or the distance between adjacent cross centers of the two sets of cross marker arrays in the row direction, the scaling ratio of the reference galvanometer and the other galvanometer to be calibrated in the X direction is calculated. Based on the ratio of the distance between the column endpoints or the distance between adjacent cross centers of the two sets of cross marker arrays in the column direction, the scaling ratio of the galvanometer to be calibrated relative to the reference galvanometer in the Y direction is calculated. With the cross center coordinates corresponding to the reference galvanometer as the reference system, the cross center coordinates corresponding to the galvanometer to be calibrated are transformed by the rotation deviation and the scaling ratio, and the average difference between the transformed coordinates and the cross center coordinates corresponding to the reference galvanometer in the X and Y directions is calculated, which are respectively used as the X translation deviation and the Y translation deviation. The rotation deviation, X scaling ratio, Y scaling ratio, X translation deviation, and Y translation deviation are used together as the overlap parameters for the two sets of cross mark arrays.

[0012] A second aspect of this application provides an overlap correction system based on dual galvanometers and machine vision. The overlap correction system includes an image processing module, a galvanometer calibration module, and an overlap calibration module. The image processing module is used to control any galvanometer to be calibrated in the SLM device to print a cross mark array on the calibration board, acquire the original image corresponding to the cross mark array, and preprocess the original image to obtain a skeletonized image. The galvanometer calibration module is used to perform cross contour filtering on the skeletonized image to obtain all cross markers in the skeletonized image, calculate the centroid coordinates corresponding to each cross marker, and construct a row and column index for each cross marker based on the centroid coordinates. Based on the row and column indexes, sub-pixel line center detection is performed on each cross marker to construct a sub-pixel center point set. A clustering algorithm based on normal vector angles separates the sub-pixel center point set into a horizontal line point set and a vertical line point set. A random sample consensus algorithm is used to perform line fitting on the horizontal line point set and the vertical line point set to obtain the cross center coordinates corresponding to the cross markers. The coordinate error of the galvanometer to be calibrated is calculated based on the cross center coordinates and the theoretical center coordinates corresponding to the galvanometer to be calibrated. The galvanometer to be calibrated is then calibrated using the coordinate error to obtain a reference galvanometer. The overlap calibration module is used to control the reference galvanometer and another galvanometer to be calibrated in the SLM device to simultaneously print two sets of cross mark arrays on the calibration board in a checkerboard pattern, calculate the overlap parameters corresponding to the two sets of cross mark arrays, and import the overlap parameters into the SLM device to complete the overlap calibration of the dual galvanometers.

[0013] A third aspect of this application provides an electronic device including a processor, a memory, a user interface, and a network interface, wherein the memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory.

[0014] A fourth aspect of this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the steps of an overlap correction method based on dual galvanometers and machine vision.

[0015] The overlap correction method and system based on dual galvanometers and machine vision provided by this invention have the following advantages over the prior art: (1) By preprocessing and skeletonizing the original image, filtering the cross contour and calculating the centroid, and combining the sub-pixel line center detection based on row and column index, the extraction accuracy of the cross center coordinates is improved to the sub-pixel level. Clustering based on normal vector angle and RANSAC line fitting are used to effectively suppress the interference of noise points, defects and local deformations, ensuring the stability and robustness of the cross center calculation. Furthermore, by comparing the cross center coordinates with the theoretical center coordinates, the coordinate error of the galvanometer to be calibrated is accurately obtained, realizing high-precision calibration and compensation of the galvanometer scanning coordinate system. This method can effectively eliminate positioning deviations caused by galvanometer installation errors, optical distortions, and system geometric errors, significantly improving the scanning positioning accuracy and repeatability of a single galvanometer. Simultaneously, by printing two sets of cross arrays in a checkerboard pattern with a reference galvanometer and another galvanometer to be calibrated, a common feature set of the two galvanometers on the same physical plane is constructed, thereby accurately obtaining the overlap parameters. After the overlap parameters are imported into the SLM device, the coordinate relationship between the two galvanometers can be uniformly calibrated and compensated, achieving high-precision overlap of the overlap area, thus significantly improving the calibration and correction efficiency of the dual galvanometer overlap.

[0016] (2) By using arc length and area thresholds to filter out background stray lines, smudges, overexposure or abnormal contours caused by ink diffusion, the final retained contours are more in line with the ideal cross structure features. Furthermore, by constraining the aspect ratio of the circumscribed rectangle within a preset range, the selected cross marks are ensured to meet the expected proportions in the length and thickness of the horizontal and vertical strokes, avoiding deformed contours caused by deformation or overlap from entering subsequent calculations. At the same time, with the cross contour set quality significantly improved, the subsequent centroid calculation, sub-pixel line center detection and straight line fitting are more reliable, thereby improving the accuracy of the cross center coordinates and thus improving the overall accuracy of galvanometer calibration and dual galvanometer overlap calibration. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart illustrating an overlap correction method based on dual galvanometers and machine vision provided by the present invention; Figure 2 A schematic diagram of a cross array for single galvanometer size calibration provided by the present invention; Figure 3 A schematic diagram of a cross array for dual-mirror overlap calibration provided by the present invention; Figure 4 This is a schematic diagram of the overlap correction system provided by the present invention; Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention.

[0019] Explanation of reference numerals in the attached figures: 1. Overlap calibration system; 11. Image processing module; 12. Galvanometer calibration module; 13. Overlap calibration module; 2. Electronic equipment; 21. Processor; 22. Communication bus; 23. User interface; 24. Network interface; 25. Memory. Detailed Implementation

[0020] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0021] This invention discloses an overlap correction method based on dual galvanometers and machine vision, with reference to... Figure 1 The steps of this method include S1 to S5.

[0022] Step S1: Control any galvanometer to be calibrated in the SLM device to print a cross mark array on the calibration board, acquire the original image corresponding to the cross mark array, and preprocess the original image to obtain a skeletonized image. In this step, the equipment used during the overlap process includes a calibration platform frame constructed from metal profiles, with an industrial camera fixed directly above the work area. The industrial camera, mounted on top of the frame with its lens facing downwards, typically has a resolution of 50 megapixels or higher and is used to photograph the crosshairs on the calibration board. An industrial light source provides uniform illumination, ensuring clearer images of the crosshairs and reducing ambient light interference. A marble platform is placed directly below the camera as a reference surface for placing the calibration board. Marble has a very low coefficient of thermal expansion and contraction and a very smooth surface, ensuring consistent positioning and levelness of the calibration board each time. The calibration software, installed on an industrial computer, includes functions such as image acquisition, crosshair detection, single galvanometer calibration, dual galvanometer overlap calibration, and result output.

[0023] Furthermore, on the selective laser melting (SLM) equipment, the galvanometer to be calibrated is selected, and according to the preset theoretical coordinates, n rows and m columns of crosshairs are marked on a glass calibration plate (or aluminum calibration plate) covered with white paper. For example, 9 rows and 9 columns, for a total of 81 crosshairs. The crosshair pattern is as follows: Figure 2 As shown. Place the prepared calibration plate flat on a marble platform, turn on the industrial light source, and use an industrial computer to control the industrial camera to take a clear photo.

[0024] Step S2: Perform cross contour filtering on the skeletonized image to obtain all cross marks in the skeletonized image, calculate the centroid coordinates corresponding to each cross mark, and construct the row and column index of each cross mark based on the centroid coordinates. Step S3: Detect sub-pixel line centers for each cross mark based on row and column indices to construct a set of sub-pixel center points. Use a clustering algorithm based on normal vector angles to separate the set of sub-pixel center points into a set of horizontal line points and a set of vertical line points. Then, use a random sample consensus algorithm to fit the horizontal and vertical line point sets to obtain the cross center coordinates corresponding to the cross mark. Step S4: Calculate the coordinate error of the galvanometer to be calibrated based on the coordinates of the crosshair center and the theoretical center coordinates corresponding to the galvanometer to be calibrated, and calibrate the galvanometer to be calibrated using the coordinate error to obtain the reference galvanometer. Step S5: Control the reference galvanometer and another galvanometer to be calibrated in the SLM device to simultaneously print two sets of cross mark arrays on the calibration board in a checkerboard pattern, calculate the overlap parameters corresponding to the two sets of cross mark arrays, and import the overlap parameters into the SLM device to complete the dual galvanometer overlap calibration.

[0025] In this implementation, through original image preprocessing and skeletonization, cross contour filtering, and centroid calculation, combined with sub-pixel line center detection based on row and column indexing, the extraction accuracy of the cross center coordinates is improved to the sub-pixel level. Clustering based on normal vector angles and RANSAC line fitting are employed to effectively suppress interference from noise points, defects, and local deformations, ensuring the stability and robustness of the cross center determination. Furthermore, by comparing the cross center coordinates with the theoretical center coordinates, the coordinate error of the galvanometer to be calibrated is accurately calculated, achieving high-precision calibration and compensation of the galvanometer scanning coordinate system. Compensation can effectively eliminate positioning deviations caused by galvanometer installation errors, optical distortions, and system geometric errors, significantly improving the scanning positioning accuracy and repeatability of a single galvanometer. Simultaneously, by printing two sets of cross arrays with a reference galvanometer and another galvanometer to be calibrated in a checkerboard pattern, a common feature set of the two galvanometers on the same physical plane is constructed, thereby accurately obtaining the overlap parameters. After the overlap parameters are imported into the SLM device, the coordinate relationship between the two galvanometers can be uniformly calibrated and compensated, achieving high-precision overlap of the overlap area, thus significantly improving the calibration and correction efficiency of the dual galvanometer overlap.

[0026] Based on the above embodiments, as an optional embodiment, step S1, which involves preprocessing the original image to obtain a skeletonized image, may further include the following: Step S11: Convert the original image corresponding to the crosshair array captured by the industrial camera into a grayscale image.

[0027] Step S12: Perform Gaussian filtering on the grayscale image to remove noise, and then superimpose the Gaussian-filtered grayscale image with the Laplacian response using preset weights to obtain a sharpened image.

[0028] In this step, the color image captured by the industrial camera is converted into a grayscale image. First, Gaussian filtering is used to remove noise, and then the Laplacian operator is used to extract edge details. The original image and the Laplacian response are superimposed with weights (weight coefficients are 1 and -1) to achieve image sharpening and make the edges of the cross lines clearer.

[0029] Step S13: Apply bilateral filtering to the sharpened image, and use the Otsu method to adaptively binarize the bilaterally filtered sharpened image to obtain a binary image in which the cross-marked region is separated from the background.

[0030] In this step, a bilateral filter is applied to the sharpened image to smooth noise while preserving the edges of the crosshairs. The parameters are: filter diameter 20, color space standard deviation 20, and coordinate space standard deviation 40. The enhanced image is then binarized using OTSU (Otsu's method) automatic thresholding to separate the crosshair-marked area (foreground) from the background. The OTSU algorithm automatically determines the optimal segmentation threshold by maximizing the inter-class variance, requiring no manual setting and adapting to images under different lighting conditions.

[0031] Step S14: Perform morphological closing operation on the binary image, and then perform skeletonization operation on the binary image processed by the closing operation to refine the multi-pixel-width cross lines in the binary image into single-pixel-width skeleton lines to obtain a skeletonized image.

[0032] In this step, a closing operation is first performed on the binary image using rectangular structuring elements (5×5 kernels) to fill in any small breaks that may exist inside the cross lines. Then, the closing operation result is skeletonized to thin the cross lines to a single pixel width. The skeletonized image retains the topological structure of the cross while greatly reducing the amount of data required for subsequent processing.

[0033] In one example, for a circular calibration board, the boundary of the calibration board can be located first using Hough circle detection to generate a circular mask, and only the image within the circular area can be processed to eliminate background interference.

[0034] Based on the above embodiments, as an optional embodiment, step S2: performing cross-shaped contour filtering on the skeletonized image to obtain all cross-shaped marks in the skeletonized image, may further include the following: Step S21: Perform contour extraction on the skeletonized image to obtain the first cross contour set; Step S22: Calculate the arc length of each cross contour in the first cross contour set, and remove cross contours with an arc length less than the first preset threshold to obtain the second cross contour set. Step S23: Calculate the area of ​​each cross contour in the second cross contour set, and remove cross contours with an area greater than the second preset threshold to obtain the third cross contour set. Step S24: Calculate the aspect ratio of the bounding rectangle of each cross contour in the third cross contour set, and retain only the cross contours whose aspect ratio is within the preset range, so as to determine the cross contour as the cross mark in the skeletonized image.

[0035] In this embodiment, arc length and area thresholds are used to filter out stray lines, blemishes, and abnormal contours caused by overexposure or ink diffusion, making the final retained contours more consistent with the ideal cross structure characteristics. By constraining the aspect ratio of the circumscribed rectangle within a preset range, it is ensured that the selected cross marks meet the expected proportions in the length and thickness of the horizontal and vertical strokes, avoiding deformed or overlapping contours from entering subsequent calculations. With a significantly improved quality of the cross contour set, subsequent centroid calculation, sub-pixel line center detection, and straight line fitting are more reliable, thereby improving the accuracy of the cross center coordinates and thus enhancing the overall accuracy of galvanometer calibration and dual galvanometer overlap calibration. By setting parameters such as arc length threshold, area threshold, and aspect ratio range, the method can be flexibly adapted to cross mark designs of different sizes, resolutions, and printing / exposure processes, expanding its engineering applicability.

[0036] In one example, contour finding is performed on the preprocessed binary image to obtain the contours of all connected regions. Since the image may contain noise such as dust and scratches, filtering is needed based on the geometric features of the crosshair markers.

[0037] Perimeter filtering: Calculates the arc length of each cross contour and removes small noise points with excessively short arc lengths. The arc length threshold is adjustable based on the actual marking effect, and is generally set to 450 pixels.

[0038] Area filtering: Calculates the area of ​​each contour and removes contours with excessively large areas (such as potential interference areas in the background). The upper limit for the area is generally set to 1500 to 3000 pixels.

[0039] Aspect Ratio Filtering: Calculate the aspect ratio of the bounding rectangle of each contour. The aspect ratio of the crosshair should be close to 1:1 (square). Therefore, only contours with an aspect ratio between 0.7 and 1.3 are retained. This condition can effectively filter out long strips or lines of noise.

[0040] Contour center calculation: For each contour that passes the filter, its centroid coordinates are calculated using image moments as the approximate center position of the cross for subsequent clustering.

[0041] Furthermore, the cross markers are arranged in a regular grid on the calibration board. To establish the row and column indexes for each cross, the scattered cross center points need to be grouped by row and column. The core clustering algorithm uses density-based spatial clustering (DBSCAN), which uses the Y-coordinate of the cross center points for row clustering and the X-coordinate for column clustering. The key parameter of DBSCAN is the neighborhood radius eps. In this embodiment, the optimal eps value is automatically determined by the sort difference jump point detection method. The principle of the sort difference jump point detection method is as follows:

[0042] Sort all coordinate values ​​to be clustered (Y coordinate for row clustering, X coordinate for column clustering) from smallest to largest, calculate the difference between adjacent coordinates, and obtain a set of difference sequence.

[0043] Sort the positive values ​​in the difference sequence (excluding zero differences caused by repeated coordinates) to obtain the difference distribution arranged from smallest to largest.

[0044] In the sorted difference distribution, calculate the spacing between adjacent differences and find the position with the largest spacing as the jump point. The differences before the jump point are small spacing within a row / column, meaning the distance between crosses in the same row or column is small and uniform. The differences after the jump point are large spacing between rows / columns, meaning the distance between crosses in different rows or columns is large.

[0045] EPS values ​​are calculated based on transition points. The difference at the transition point is taken as the upper bound of the inline spacing, and the difference after the transition point is taken as the lower bound of the interline spacing. EPS is a conservative value between the two—the minimum is 1.4 times the upper bound of the inline spacing and 0.5 times the lower bound of the interline spacing, and is not less than 3 pixels, ensuring that crosses in the same row / column are aggregated into one class through the chain propagation of DBSCAN, and crosses in different rows / columns are not mistakenly merged.

[0046] Based on the above embodiments, as an optional embodiment, step S3, which involves filtering the skeletonized image by cross outlines to obtain all cross marks in the skeletonized image, may further include the following: Step S31: Morphological dilation of the cross mark is performed based on the skeletonized image, and the dilation radius is determined according to the Gaussian smoothing scale parameter to generate a region of interest mask limited to the periphery of the cross mark. Gray-level candidate pixels are selected based on the preset relationship between local mean and standard deviation.

[0047] In this step, the computational region is determined based on the generated skeletonized image. Morphological dilation is then performed on the skeletonized image, with the dilation radius... ,in, The round-up function, This represents the Gaussian scaling parameter, initially set to 1.5 and subsequently updated adaptively. A Region of Interest (ROI) mask is generated, and all subsequent derivative calculations and Hessian analyses are confined to pixels within this mask. Gaussian filtering is applied to the image within the ROI mask to eliminate the influence of high-frequency noise on derivative calculations. This mechanism reduces the number of grayscale candidate pixels by over 90% and naturally eliminates pseudo-line points that may be generated in background noise areas, improving both computational efficiency and detection accuracy.

[0048] For each pixel within the ROI mask, calculate the average grayscale value within its 31×31 neighborhood window, centered on that pixel. and standard deviation Dynamically set the candidate grayscale range to Only pixels whose grayscale values ​​fall within this range are included in the candidate set for subsequent derivative calculations and Hessian analysis. This local adaptive mechanism allows the grayscale selection criteria to automatically adjust according to the local statistical characteristics of the image, eliminating the sensitivity of the globally fixed threshold in traditional methods to large-scale illumination changes. This ensures that line pixels can be stably detected under different illumination conditions, and at this point, grayscale candidate pixels that meet the candidate grayscale range are selected.

[0049] Step S32: Based on the centroid coordinates of each cross mark and the row and column indices corresponding to the cross mark, the local detection window is cropped. Within the local detection window and the region of interest mask, the Gaussian smoothing scale is determined by using a preset local line width. The first and second partial derivatives are calculated for gray-level candidate pixels to construct the Hessian matrix corresponding to the gray-level candidate pixels. The eigenvector corresponding to the eigenvalue with the largest absolute value in the Hessian matrix is ​​used as the line normal vector.

[0050] In this step, before the formal derivative calculation, a local grayscale profile is sampled along the normal direction of the skeleton point for each cross region in the grayscale candidate pixels. The full width at half maximum (FWHM) of the line profile is calculated by fitting a Gaussian line model. The theoretical relationship between the line model parameters and the optimal detection scale—the line half-width—is then utilized. Optimal Gaussian Scale This involves adaptively determining the Gaussian smoothing parameters for each cross-shaped region. When the local grayscale profile does not conform to the Gaussian line type or the linewidth estimation exceeds a reasonable range, it reverts to the default value. =1.5. Simultaneously, feedback is provided to update the ROI expansion radius. This adaptive mechanism ensures that the Hessian matrix is ​​always calculated at the optimal scale under different line widths, improving the consistency and accuracy of line center positioning.

[0051] Furthermore, in determining the ROI mask, completing the grayscale candidate pixel pre-screening, and adaptive... After selection, obtain the local cross-shaped magnified grayscale image centered on each cross's centroid and the grayscale candidate pixel calculation image constructed using the local ROI mask. Then, use the Sobel operator to calculate the first-order partial derivative of the grayscale candidate pixel image. and second-order partial derivatives These derivatives describe the local shape of the image's grayscale surface. By employing full-image vectorization calculations instead of pixel-by-pixel iteration, derivative operations are performed only on selected grayscale candidate pixels, resulting in high processing efficiency.

[0052] For each grayscale candidate pixel location, a 2×2 Hessian matrix is ​​constructed using the second-order partial derivatives. The eigenvalues ​​of this Hessian matrix and The principal curvature directions and magnitudes of the grayscale surface are described: For an ideal line structure, the curvature along the tangent direction of the line is close to zero, while the absolute value of the curvature along the normal direction of the line is the largest. Therefore, the eigenvector corresponding to the eigenvalue with the largest absolute value is taken as the estimate of the line normal direction.

[0053] For a 2×2 real symmetric Hessian matrix, the eigenvalues ​​and eigenvectors are directly calculated using a closed-form analytical formula: eigenvalues ;when Time feature vector take Direction, among which, Represents matrix elements , Represents matrix elements ,when The eigenvectors along the coordinate axes are normalized to obtain the unit normal vector. The analytical solution replaces the numerical iterative eigenvalue decomposition in traditional methods, significantly improving the computation speed of batch pixels while ensuring mathematical equivalence.

[0054] Step S33: Perform a second-order Taylor expansion on the line normal vector and grayscale candidate pixels to obtain the sub-pixel center coordinates that satisfy the preset offset constraint conditions. Summarize the sub-pixel center coordinates corresponding to each cross mark to construct a set of sub-pixel center points.

[0055] In this step, the direction of the line normal is obtained. Then, perform a second-order Taylor expansion of the grayscale value at the current position along the normal direction, find the points where the first derivative is zero (i.e., the grayscale extreme points), and obtain the sub-pixel offset. Limit component offset and This ensures that the subpixel-corrected position still falls within the current pixel unit. The final subpixel center coordinates are... Simultaneously record the normal direction For use in subsequent line separation.

[0056] Based on the above embodiments, as an optional embodiment, step S3, which involves using a clustering algorithm based on normal vector angles to separate the sub-pixel center point set into a horizontal line point set and a vertical line point set, may further include the following: Step S34: Based on the normal vector of each sub-pixel center point in the sub-pixel center point set, calculate the orientation angle feature of the sub-pixel center point, and limit the orientation angle corresponding to the orientation angle feature to a preset angle range; Step S35: Input the orientation angle features of all sub-pixel center points as one-dimensional clustering features into the clustering algorithm. Based on orientation angle similarity and point density, automatically group the sub-pixel center points. Classify the group of points whose orientation angles are clustered within the first angle range as the horizontal line point set, and classify the group of points whose orientation angles are clustered within the second angle range as the vertical line point set.

[0057] In this embodiment, the traditional approach uses a fixed normal vector threshold. When the crosshair is rotated (e.g., due to a deviation in the calibration board's placement angle), the line normal vector is no longer close to the coordinate axis direction, and the fixed threshold will cause a large number of valid points to be incorrectly discarded. This embodiment uses the DBSCAN clustering method instead of the fixed threshold: the normal vector direction angle of each sub-pixel is used as a one-dimensional clustering feature, i.e. right Modulo, mapping to The interval is used to estimate the cluster radius using the sorting difference jump point detection method. The points output by the Steger algorithm are clustered into two main directional clusters: the cluster with a normal vector angle close to 0 corresponds to the vertical line segment, whose normal direction is close to horizontal and whose normal vector angle is close to 0. The cluster with a value of 2 corresponds to a horizontal line segment, and its normal direction is nearly perpendicular. This adaptive classification method based on geometric attributes is robust to any rotation angle of the cross and does not depend on coordinate thresholds.

[0058] Based on the above embodiments, as an optional embodiment, step S3, which involves performing line fitting on the horizontal and vertical line point sets using a random sample consensus algorithm to obtain the cross center coordinates corresponding to the cross markers, may further include the following: Step S36: For each set of horizontal line points corresponding to a cross mark, the first inner point is randomly selected multiple times using the random sample consensus algorithm, and a candidate horizontal line model is established. The candidate horizontal line with the largest number of first inner points and the smallest residual is selected as the horizontal line of the cross mark. Step S37: For each set of vertical line points corresponding to a cross mark, the random sample consensus algorithm is used to randomly select the second inner point multiple times and establish a candidate vertical line model. The candidate vertical line with the largest number of first inner points and the smallest residual is selected as the vertical line of the cross mark. Step S38: Solve the equations of the horizontal and vertical lines to find the intersection point, and use the coordinates of the intersection point as the coordinates of the center of the cross mark.

[0059] In one example, Random Sampling Consensus (RANSAC) line fitting is performed on the horizontal and vertical line point sets respectively. The core advantage of RANSAC is that it can automatically identify and exclude outliers. Even if there are a few noisy points or false positives in the detection results output by the Steger algorithm, RANSAC can accurately estimate the slope and intercept of the line from the noisy data.

[0060] Furthermore, a confidence-weighted mechanism based on Hessian response quality is introduced, whereby each sub-pixel output by the Steger algorithm, in addition to its coordinates and normal vector, also includes a confidence index—this confidence score is calculated as the ratio of the eigenvalues ​​of the Hessian matrix (…). (Reflecting the salience of the line structure) and the gradient magnitude of the normal direction. The decision is made jointly, and the calculation formula is expressed as follows:

[0061] in, This represents the absolute value of the first eigenvalue in the Hessian matrix. This represents the absolute value of the second eigenvalue in the Hessian matrix. In the random sampling phase of RANSAC, the probability of each point being selected as a seed point is proportional to its confidence level (weighted sampling), making high-precision points more likely to participate in the initial model estimation. In the final interior least squares refinement phase, the confidence level of each interior point is used as a weight for weighted least squares fitting, so that the fitting result is more affected by high-quality points, further improving the estimation accuracy of the line parameters.

[0062] For horizontal lines, a model is used. The residual threshold is 3 pixels; for vertical lines, to avoid the problem of infinite slope, the roles of x and y are swapped, and a model is used. The residual threshold is also 3 pixels. Represents the slope of a straight line. This represents the intercept of the line on the coordinate axis. The maximum number of iterations is set to 1000 to ensure sufficient random sampling by RANSAC. The fitting result is converted to the general form of the line. ,in, and Both represent unit normal vectors. This represents a constant term.

[0063] After obtaining the equations of the horizontal and vertical lines, calculate the coordinates of the intersection point using the coefficients of the general forms of the two lines: Let the equation of the horizontal line be The equation of the vertical line is When the determinant When the two lines are not parallel, the coordinates of the intersection point are: Because the horizontal and vertical lines of the cross are physically orthogonal, The values ​​are usually much greater than zero, and the intersection point calculation is stable and reliable. The final intersection point coordinates, plus the offset of the cross region in the entire image, give the precise position of the cross in the image coordinate system.

[0064] Furthermore, after completing the intersection detection of all crosshairs, a physical coordinate system needs to be established and the pixel coordinates converted to millimeter coordinates. The specific steps are as follows:

[0065] The origin of the coordinate system is selected as the intersection of the middle row and middle column of the array. The coordinates of the origin are subtracted from the coordinates of all the crosses to achieve coordinate translation.

[0066] Since the calibration plate may have undergone slight rotation during placement, the coordinate system needs to be rotated and corrected. Take all the cross coordinates of the row containing the origin, fit a straight line using the least squares method, remove the two points with the largest residuals to reduce interference, and calculate the rotation angle based on the slope of the fitted line. , This represents the slope of the line. A rotation matrix is ​​applied to the entire coordinate array. This aligns the X-axis with the row direction of the crosshair array. Using pre-calibrated pixel-to-millimeter conversion factors (obtained by photographing standard blocks of known size), the pixel coordinates are converted to physical coordinates in millimeters. Conversion factors for the horizontal and vertical directions are calibrated separately to compensate for any slight differences that may exist between the camera and these directions.

[0067] Based on the above embodiments, as an optional embodiment, step S5, which involves calculating the overlap parameters corresponding to the two sets of cross-marker arrays, may further include the following: Step S51: Based on the cross center coordinates of the reference galvanometer and another galvanometer to be calibrated in the two sets of cross mark arrays printed, perform linear fitting on the cross center coordinates of each row or column to obtain the main direction vectors of the two sets of cross mark arrays in the row and column directions, and calculate the rotational deviation between the two sets of cross mark arrays based on the angle between the main direction vectors.

[0068] Step S52: Based on the ratio of the distance between the row endpoints or the distance between adjacent cross centers of the two sets of cross marker arrays in the row direction, calculate the scaling ratio of the reference galvanometer and the other galvanometer to be calibrated in the X direction. Based on the ratio of the distance between the column endpoints or the distance between adjacent cross centers of the two sets of cross marker arrays in the column direction, calculate the scaling ratio of the galvanometer to be calibrated relative to the reference galvanometer in the Y direction.

[0069] In this step, such as Figure 3 As shown, the parity of the checkerboard pattern is used to automatically distinguish between the two sets of lasers. For row and column indices... ,when When the number is even, it belongs to the reference laser. When the number is odd, it belongs to the laser to be calibrated. This method requires no additional markings and automatically separates them entirely based on the arrangement pattern.

[0070] Singular value decomposition (SVD) linear fitting was performed on the crosshair arrays of the two laser systems, both row-wise and column-wise. For each row, the coordinates of the crosshair points were centered to construct a matrix. ,right Perform SVD decomposition ,in, Describes a left singular vector matrix. Represents a singular value diagonal matrix. Describes a right singular vector matrix, where the right singular vectors are... The first row represents the principal direction vector of the point set in that row, and the deflection angle is calculated using the arctan function. The average of the angles in each row / column is taken as the overall deflection angle of the laser, and the difference between the two sets of laser deflection angles is the rotation deviation. Simultaneously, the ratio of the pixel distances from the starting point to the ending point in the row direction (reference / to-be-calibrated) is the scaling ratio in the X direction, and the ratio of the distances in the column direction is the scaling ratio in the Y direction.

[0071] Step S53: Under the condition that the cross center coordinates corresponding to the reference galvanometer are used as the reference system, the cross center coordinates corresponding to the galvanometer to be calibrated are transformed by rotation deviation and scaling ratio, and the average difference between the transformed coordinates and the cross center coordinates corresponding to the reference galvanometer in the X and Y directions is calculated, which are respectively used as X translation deviation and Y translation deviation.

[0072] In this step, the rotation center of the galvanometer is found in the skeletonized image using Hough Circles. The circle with the largest X-coordinate is the rotation center, and this is used as the origin of the coordinate system. All crosshair coordinates of the laser to be calibrated are corrected by rotation deviation and scaling. Then, in the corrected coordinate system, the average distance between the two sets of laser crosshairs in the X and Y directions is calculated, which are the X translation deviation and Y translation deviation.

[0073] Step S54: The rotation deviation, X scaling ratio, Y scaling ratio, X translation deviation, and Y translation deviation are used together as the overlapping parameters of the two sets of cross mark arrays.

[0074] Based on the above method, this application discloses an overlap correction system based on dual galvanometers and machine vision, with reference to... Figure 4 The overlap correction system 1 includes an image processing module 11, a galvanometer calibration module 12, and an overlap calibration module 13, wherein... The image processing module 11 is used to control any galvanometer to be calibrated in the SLM device to print a cross mark array on the calibration board, acquire the original image corresponding to the cross mark array, and preprocess the original image to obtain a skeletonized image. The galvanometer calibration module 12 is used to perform cross contour filtering on the skeletonized image to obtain all cross marks in the skeletonized image, calculate the centroid coordinates corresponding to each cross mark, and construct the row and column index of each cross mark based on the centroid coordinates. Based on the row and column index, sub-pixel line center detection is performed on each cross mark to construct a sub-pixel center point set. The sub-pixel center point set is separated into a horizontal line point set and a vertical line point set by a clustering algorithm based on the normal vector angle. The horizontal line point set and the vertical line point set are fitted with a straight line using a random sample consensus algorithm to obtain the cross center coordinates corresponding to the cross mark. The coordinate error of the galvanometer to be calibrated is calculated based on the cross center coordinates and the theoretical center coordinates corresponding to the galvanometer to be calibrated. The galvanometer to be calibrated is then calibrated using the coordinate error to obtain the reference galvanometer. The overlap calibration module 13 is used to control the reference galvanometer and another galvanometer to be calibrated in the SLM equipment to simultaneously print two sets of cross mark arrays on the calibration board in a checkerboard pattern, calculate the overlap parameters corresponding to the two sets of cross mark arrays, and import the overlap parameters into the SLM equipment to complete the overlap calibration of the dual galvanometers.

[0075] In one example, the image processing module 11 is used to convert the original image corresponding to the crosshair array acquired by the industrial camera into a grayscale image; to perform Gaussian filtering on the grayscale image for noise reduction, and to superimpose the Gaussian-filtered grayscale image with the Laplacian response with a preset weight to obtain a sharpened image; to apply bilateral filtering to the sharpened image, and to perform adaptive binarization on the bilaterally filtered sharpened image using the Otsu method to obtain a binary image in which the crosshair region is separated from the background; to perform morphological closing operation on the binary image, and to perform skeletonization operation on the binary image after closing operation to refine the multi-pixel-width crosshair lines in the binary image into single-pixel-width skeleton lines to obtain a skeletonized image.

[0076] In one example, the galvanometer calibration module 12 is used to perform contour extraction on the skeletonized image to obtain a first set of cross contours; calculate the arc length of each cross contour in the first set of cross contours, and remove cross contours with arc lengths less than a first preset threshold to obtain a second set of cross contours; calculate the area of ​​each cross contour in the second set of cross contours, and remove cross contours with areas greater than a second preset threshold to obtain a third set of cross contours; calculate the aspect ratio of the bounding rectangle of each cross contour in the third set of cross contours, and retain only cross contours with aspect ratios within a preset range to determine the cross contours as cross markers in the skeletonized image.

[0077] In one example, the galvanometer calibration module 12 is used to perform morphological dilation on the cross markers based on the skeletonized image, and determine the dilation radius according to the Gaussian smoothing scale parameter to generate a region of interest mask limited to the periphery of the cross markers. Gray-level candidate pixels are selected based on the relationship between the preset local mean and standard deviation. The local detection window is cropped based on the centroid coordinates of each cross marker and the row and column index corresponding to the cross marker. Within the local detection window and the region of interest mask, the Gaussian smoothing scale is determined using the preset local line width. The first and second partial derivatives are calculated for the gray-level candidate pixels to construct the Hessian matrix corresponding to the gray-level candidate pixels. The eigenvector corresponding to the eigenvalue with the largest absolute value in the Hessian matrix is ​​used as the line normal vector. The line normal vector and the gray-level candidate pixels are subjected to a second-order Taylor expansion to obtain the sub-pixel center coordinates that satisfy the preset offset constraint conditions. The sub-pixel center coordinates corresponding to each cross marker are summarized to construct a set of sub-pixel center points.

[0078] In one example, the galvanometer calibration module 12 is used to calculate the orientation angle features of the sub-pixel center points based on the normal vector of each sub-pixel center point in the sub-pixel center point set, and to limit the orientation angles corresponding to the orientation angle features to a preset angle range; the orientation angle features of all sub-pixel center points are used as one-dimensional clustering features to input the clustering algorithm, and the sub-pixel center points are automatically grouped based on orientation angle similarity and point density, and a group of points whose orientation angles are clustered within the first angle range are classified as a horizontal line point set, and a group of points whose orientation angles are clustered within the second angle range are classified as a vertical line point set.

[0079] In one example, the galvanometer calibration module 12 is used to randomly select the first inner point multiple times and establish a candidate horizontal line model for the set of horizontal line points corresponding to each cross mark using a random sample consensus algorithm. The candidate horizontal line with the largest number of first inner points and the smallest residual is selected as the horizontal line of the cross mark. For the set of vertical line points corresponding to each cross mark, the second inner point is randomly selected multiple times and a candidate vertical line model is established using a random sample consensus algorithm. The candidate vertical line with the largest number of first inner points and the smallest residual is selected as the vertical line of the cross mark. The intersection point is obtained by combining the horizontal line and the vertical line, and the coordinates of the intersection point are used as the coordinates of the cross center of the cross mark.

[0080] In one example, the overlap calibration module 13 is used to perform linear fitting on the cross center coordinates of each row or column of the two sets of cross marker arrays based on the cross center coordinates of the reference galvanometer and the other galvanometer to be calibrated, respectively, to obtain the principal direction vectors of the two sets of cross marker arrays in the row and column directions, and calculate the rotational deviation between the two sets of cross marker arrays based on the angle between the principal direction vectors; based on the ratio of the distance between the row endpoints or the distance between adjacent cross centers of the two sets of cross marker arrays in the row direction, it calculates the scaling ratio of the reference galvanometer and the other galvanometer to be calibrated in the X direction, and based on the ratio of the distance between the row endpoints or the distance between adjacent cross centers of the two sets of cross marker arrays in the column direction, it calculates the scaling ratio of the reference galvanometer and the other galvanometer to be calibrated in the X direction. The ratio of the distance between the upward column endpoints or the distance between adjacent cross centers is used to calculate the scaling ratio of the galvanometer to be calibrated relative to the reference galvanometer in the Y direction. Under the condition that the cross center coordinates corresponding to the reference galvanometer are used as the reference system, the cross center coordinates corresponding to the galvanometer to be calibrated are transformed by rotation deviation and scaling ratio, and the average difference between the transformed coordinates and the cross center coordinates corresponding to the reference galvanometer in the X and Y directions is calculated, which are used as the X translation deviation and Y translation deviation, respectively. The rotation deviation, X scaling ratio, Y scaling ratio, X translation deviation, and Y translation deviation are used together as the overlap parameters of the two sets of cross mark arrays.

[0081] Please see Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device 2 may include: at least one processor 21, at least one network interface 24, user interface 23, memory 25, and at least one communication bus 22.

[0082] The communication bus 22 is used to enable communication between these components.

[0083] The user interface 23 may include a display screen and a camera. Optionally, the user interface 23 may also include a standard wired interface and a wireless interface.

[0084] The network interface 24 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0085] The processor 21 may include one or more processing cores. The processor 21 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 25, and by calling data stored in the memory 25. Optionally, the processor 21 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor 21.

[0086] The memory 25 may include random access memory (RAM) or read-only memory. Optionally, the memory 25 may include non-transitory computer-readable storage medium. The memory 25 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 25 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 25 may also be at least one storage device located remotely from the aforementioned processor 21. Figure 5 As shown, the memory 25, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program based on a method for lap correction using dual galvanometers and machine vision.

[0087] exist Figure 5In the electronic device 2 shown, the user interface 23 is mainly used to provide an input interface for the user and to obtain the user input data; while the processor 21 can be used to call an application program stored in the memory 25 that is a method for overlapping correction based on dual galvanometers and machine vision. When executed by one or more processors, the electronic device performs one or more methods as described in the above embodiments.

[0088] A non-transitory computer-readable storage medium stores instructions that, when executed by one or more processors, cause a computer to perform one or more methods as described in the above embodiments.

[0089] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0090] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0091] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the shown or discussed mutual couplings or direct couplings or communication connections may be through some service interfaces; indirect couplings or communication connections between apparatuses or units may be electrical or other forms.

[0092] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0093] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0094] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0095] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for overlap correction based on dual galvanometers and machine vision, characterized in that, The method includes: Control any galvanometer to be calibrated in the SLM device to print a cross mark array on the calibration board, acquire the original image corresponding to the cross mark array, and preprocess the original image to obtain a skeletonized image; The skeletonized image is subjected to cross contour filtering to obtain all cross marks in the skeletonized image. The centroid coordinates corresponding to each cross mark are calculated, and the row and column indexes of each cross mark are constructed based on the centroid coordinates. Based on the row and column index, sub-pixel line center detection is performed on each cross mark to construct a sub-pixel center point set. A clustering algorithm based on normal vector angle separates the sub-pixel center point set into a horizontal line point set and a vertical line point set. The horizontal line point set and the vertical line point set are then fitted with a straight line using a random sample consensus algorithm to obtain the cross center coordinates corresponding to the cross mark. The coordinate error of the galvanometer to be calibrated is calculated based on the coordinates of the crosshair center and the theoretical center coordinates corresponding to the galvanometer to be calibrated, and the galvanometer to be calibrated is calibrated using the coordinate error to obtain a reference galvanometer. The reference galvanometer and another galvanometer to be calibrated in the SLM device are controlled to simultaneously print two sets of cross mark arrays on the calibration board in a checkerboard pattern, and the overlap parameters corresponding to the two sets of cross mark arrays are calculated. The overlap parameters are then imported into the SLM device to complete the dual galvanometer overlap calibration.

2. The overlap correction method based on dual galvanometers and machine vision as described in claim 1, characterized in that, The preprocessing of the original image to obtain a skeletonized image specifically includes: Convert the original image corresponding to the crosshair array captured by the industrial camera into a grayscale image; The grayscale image is denoised by Gaussian filtering, and the denoised grayscale image is superimposed with the Laplacian response with a preset weight to obtain a sharpened image. A bilateral filter is applied to the sharpened image, and the Otsu method is used to adaptively binarize the bilaterally filtered sharpened image to obtain a binary image in which the cross-marked region is separated from the background. A morphological closing operation is performed on the binary image, and a skeletonization operation is performed on the binary image after the closing operation, so as to refine the multi-pixel-width cross lines in the binary image into single-pixel-width skeleton lines to obtain the skeletonized image.

3. The overlap correction method based on dual galvanometers and machine vision as described in claim 1, characterized in that, The step of performing cross-shaped contour filtering on the skeletonized image to obtain all cross-shaped markers in the skeletonized image specifically includes: Contour extraction is performed on the skeletonized image to obtain a first cross-shaped contour set; Calculate the arc length of each cross contour in the first cross contour set, and remove cross contours with an arc length less than a first preset threshold to obtain a second cross contour set. Calculate the area of ​​each cross contour in the second cross contour set, and remove cross contours with an area greater than a second preset threshold to obtain a third cross contour set. Calculate the aspect ratio of the bounding rectangle of each cross contour in the third cross contour set, and retain only the cross contours whose aspect ratio is within a preset range, so as to determine the cross contour as the cross mark in the skeletonized image.

4. The overlap correction method based on dual galvanometers and machine vision as described in claim 1, characterized in that, The step of performing sub-pixel line center detection on each cross mark based on the row and column index to construct a sub-pixel center point set specifically includes: Based on the skeletonized image, the cross mark is morphologically dilated, and the dilation radius is determined according to the Gaussian smoothing scale parameter to generate a region of interest mask limited to the periphery of the cross mark. Gray-level candidate pixels are selected based on the preset relationship between local mean and standard deviation. The local detection window is clipped based on the centroid coordinates of each cross mark and the row and column index corresponding to the cross mark. Within the local detection window and the region of interest mask, the Gaussian smoothing scale is determined by using a preset local line width. The first and second partial derivatives are calculated for the gray-level candidate pixels to construct the Hessian matrix corresponding to the gray-level candidate pixels. The eigenvector corresponding to the eigenvalue with the largest absolute value in the Hessian matrix is ​​used as the line normal vector. A second-order Taylor expansion is performed on the line normal vector and the grayscale candidate pixels to obtain the sub-pixel center coordinates that satisfy the preset offset constraint conditions. The sub-pixel center coordinates corresponding to each cross mark are summarized to construct a set of sub-pixel center points.

5. The overlap correction method based on dual galvanometers and machine vision as described in claim 1, characterized in that, The clustering algorithm based on normal vector angle separates the sub-pixel center point set into a horizontal line point set and a vertical line point set, specifically including: Based on the normal vector of each sub-pixel center point in the set of sub-pixel center points, the orientation angle feature of the sub-pixel center point is calculated, and the orientation angle corresponding to the orientation angle feature is limited to a preset angle range. The orientation angle features of all sub-pixel center points are used as one-dimensional clustering features and input into the clustering algorithm. The sub-pixel center points are automatically grouped based on orientation angle similarity and point density. A group of points whose orientation angles are clustered within a first angle range is classified as a horizontal line point set, and a group of points whose orientation angles are clustered within a second angle range is classified as a vertical line point set.

6. The overlap correction method based on dual galvanometers and machine vision as described in claim 1, characterized in that, The step of performing line fitting on the horizontal and vertical line point sets using a random sample consensus algorithm to obtain the cross center coordinates corresponding to the cross mark specifically includes: For each set of horizontal line points corresponding to a cross mark, the first inner point is randomly selected multiple times using the random sample consensus algorithm, and a candidate horizontal line model is established. The candidate horizontal line with the largest number of first inner points and the smallest residual is selected as the horizontal line of the cross mark. For each set of vertical line points corresponding to a cross mark, the random sample consensus algorithm is used to randomly select the second inner point multiple times and establish a candidate vertical line model. The candidate vertical line with the largest number of first inner points and the smallest residual is selected as the vertical line of the cross mark. Find the intersection point by combining the horizontal line and the vertical line, and use the coordinates of the intersection point as the coordinates of the center of the cross mark.

7. The overlap correction method based on dual galvanometers and machine vision as described in claim 1, characterized in that, The calculation of the overlap parameters corresponding to the two sets of cross-marker arrays specifically includes: Based on the cross center coordinates of the reference galvanometer and another galvanometer to be calibrated in the two sets of cross mark arrays printed, respectively, the cross center coordinates of each row or column are fitted with a straight line to obtain the main direction vectors of the two sets of cross mark arrays in the row and column directions, and the rotational deviation between the two sets of cross mark arrays is calculated by the angle between the main direction vectors. Based on the ratio of the distance between the row endpoints or the distance between adjacent cross centers of the two sets of cross marker arrays in the row direction, the scaling ratio of the reference galvanometer and the other galvanometer to be calibrated in the X direction is calculated. Based on the ratio of the distance between the column endpoints or the distance between adjacent cross centers of the two sets of cross marker arrays in the column direction, the scaling ratio of the galvanometer to be calibrated relative to the reference galvanometer in the Y direction is calculated. With the cross center coordinates corresponding to the reference galvanometer as the reference system, the cross center coordinates corresponding to the galvanometer to be calibrated are transformed by the rotation deviation and the scaling ratio, and the average difference between the transformed coordinates and the cross center coordinates corresponding to the reference galvanometer in the X and Y directions is calculated, which are respectively used as the X translation deviation and the Y translation deviation. The rotation deviation, X scaling ratio, Y scaling ratio, X translation deviation, and Y translation deviation are used together as the overlap parameters for the two sets of cross mark arrays.

8. A joint correction system based on dual galvanometers and machine vision, characterized in that, The overlap correction system includes an image processing module, a galvanometer calibration module, and an overlap calibration module, wherein... The image processing module is used to control any galvanometer to be calibrated in the SLM device to print a cross mark array on the calibration board, acquire the original image corresponding to the cross mark array, and preprocess the original image to obtain a skeletonized image. The galvanometer calibration module is used to perform cross contour filtering on the skeletonized image to obtain all cross markers in the skeletonized image, calculate the centroid coordinates corresponding to each cross marker, and construct a row and column index for each cross marker based on the centroid coordinates. Based on the row and column indexes, sub-pixel line center detection is performed on each cross marker to construct a sub-pixel center point set. A clustering algorithm based on normal vector angles separates the sub-pixel center point set into a horizontal line point set and a vertical line point set. A random sample consensus algorithm is used to perform line fitting on the horizontal line point set and the vertical line point set to obtain the cross center coordinates corresponding to the cross markers. The coordinate error of the galvanometer to be calibrated is calculated based on the cross center coordinates and the theoretical center coordinates corresponding to the galvanometer to be calibrated. The galvanometer to be calibrated is then calibrated using the coordinate error to obtain a reference galvanometer. The overlap calibration module is used to control the reference galvanometer and another galvanometer to be calibrated in the SLM device to simultaneously print two sets of cross mark arrays on the calibration board in a checkerboard pattern, calculate the overlap parameters corresponding to the two sets of cross mark arrays, and import the overlap parameters into the SLM device to complete the overlap calibration of the dual galvanometers.

9. An electronic device, characterized in that, The device includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1-7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • A cross structure light plane calibration method

    CN121685667B