A method for automatic mirror correction compensation
Patent Information
- Application Number
- CN202611392359.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-10-09
AI Technical Summary
上述方法本质上是一种开环手动标定过程,即通过人工测量获取系统输出偏差,再手动录入校正程序以调整控制参数,整个过程缺乏自动化的偏差检测与闭环修正机制
1、本申请的一种自动振镜校正补偿的方法,通过标刻十字标记点、由运动模块承载标刻完成十字标记点的振镜校正标靶移动至采集模块的理论采集基准位置、采集原始图像、采用加权分块改进单尺度Retinex算法对原始图像进行灰度自适应均衡处理、去除背景噪声和划痕干扰后分离十字目标前景区域、采用改进EDLines直线检测算法提取十字目标前景区域中的横线直线和竖线直线以计算十字标记点的倾斜角度、根据倾斜角度控制运动模块旋转以完成振镜校正标靶的姿态修正、采集姿态修正后的十字标记点的修正图像、再次采用改进EDLines直线检测算法提取修正图像中的横线直线和竖线直线以计算十字标记点的中心坐标、根据中心坐标与理论基准坐标计算X轴和Y轴方向位置误差、遍历全部十字标记点并重复执行移动采集及计算步骤直至全部十字标记点处理完毕、根据全部十字标记点的位置误差生成振镜补偿文件以完成振镜校正,实现了振镜校正的全流程自动化,无需人工逐点测量和录入数据,大幅缩短了标定工时,适配产线批量设备统一校准。
Smart Images

Figure CN122888017A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of control, regulation and correction technology, and more specifically to a method for automatic galvanometer correction and compensation. Background Technology
[0002] A galvanometer scanning system is a high-precision beam deflection control device. It precisely adjusts the laser beam direction by controlling the galvanometer deflection angle, and is the core execution unit for high-speed scanning and precise positioning in laser processing equipment. In the galvanometer scanning system, control commands drive the galvanometer to deflect, causing the laser beam to be focused onto the focal plane by the field lens. However, due to the inherent surface curvature of the field lens, there is a non-linear deviation between the actual and theoretical landing points of the laser beam during scanning, resulting in geometric distortion of the etched pattern. To ensure the positional accuracy of laser processing, the control parameters at each point of the galvanometer must be corrected using a distortion correction compensation file to make the actual scanning trajectory approximate the theoretical trajectory.
[0003] Currently, galvanometer distortion correction commonly employs manual grid calibration. Operators first use calibration software to mark a uniformly distributed grid target on the focal plane. Using the grid center point as the coordinate origin, they measure the actual XY offset of each feature point using a ruler or vernier caliper. The coordinate values are then manually obtained by interpreting the scale readings and entered into the calibration program, ultimately generating a distortion compensation file. This method is essentially an open-loop manual calibration process; it involves manually measuring the system output deviation and then manually entering the calibration program to adjust control parameters. The entire process lacks automated deviation detection and closed-loop correction mechanisms.
[0004] However, the aforementioned existing technologies have the following drawbacks: Multiple processes such as marking, measuring, inputting, and verifying are cyclically superimposed, resulting in a long calibration cycle and making it difficult to meet the production efficiency requirements of unified calibration for batch equipment. Manual reading errors and differences in operating techniques lead to discrete calibration parameters, poor calibration consistency and repeatability, and an inability to guarantee processing consistency across multiple machines. The upper limit of accuracy for manual calibration is limited by the scale resolution of the measuring tool and the operator's visual interpretation ability, making it difficult to meet the process requirements of micron-level high-precision laser processing scenarios for the geometric accuracy of the galvanometer's surface. Furthermore, the aforementioned manual calibration process cannot achieve automatic closed-loop adjustment of calibration parameters and lacks a real-time detection and feedback control mechanism for system output deviations, resulting in low calibration efficiency and poor system robustness.
[0005] Therefore, there is an urgent need for an automatic galvanometer correction and compensation method that, through the coordinated cooperation of image acquisition, automatic detection and control algorithms, achieves fully automated closed-loop adjustment of the galvanometer correction process, in order to solve the technical problems existing in the current technology. Summary of the Invention
[0006] The purpose of this application is to provide an automatic galvanometer correction and compensation method that can solve at least one of the technical problems mentioned above. The specific solution is as follows: According to a specific embodiment of this application, this application provides a method for automatic galvanometer correction and compensation, comprising the following steps: The galvanometer scanning module is controlled to mark crosshair points with a grid distribution on the surface of the galvanometer calibration target; The motion control module carries the galvanometer calibration target that completes the marking of the crosshair mark, so that the crosshair mark to be detected is moved to the theoretical acquisition reference position of the acquisition module; Acquire the original image of the current crosshair marker point; The original image is subjected to grayscale adaptive equalization using a weighted block-based improved single-scale Retinex algorithm to obtain an equalized image. Background noise and scratch interference are removed from the equalized image to separate the foreground region of the cross-shaped target; An improved EDLines line detection algorithm is used to extract horizontal and vertical lines in the foreground region of the cross-shaped target, and the tilt angle of the cross-shaped marker point is calculated. The motion module is controlled to rotate according to the tilt angle to complete the attitude correction of the galvanometer correction target; Acquire corrected images of the crosshair markers after attitude correction; The improved EDLines line detection algorithm is used to extract horizontal and vertical lines from the corrected image, and the center coordinates of the crosshair markers are calculated. Calculate the X-axis and Y-axis position errors based on the center coordinates and the theoretical reference coordinates; The process involves iterating through each crosshair mark on the galvanometer calibration target, repeating the movement, acquisition, and calculation steps until all crosshair marks have been processed. After all crosshair markers have been processed, a galvanometer compensation file is generated based on the positional errors of all crosshair markers. The galvanometer calibration is then completed based on the galvanometer compensation file.
[0007] Furthermore, the weighted block-based improved single-scale Retinex algorithm includes the following steps: The original image is used as a grayscale image of the crosshair markers and normalized to the grayscale range. Calculate the global grayscale mean of the entire grayscale image of the crosshair markers; A sliding window is used to traverse the entire grayscale image of the crosshair markers, and the mean value of local sub-blocks is calculated pixel by pixel. Calculate pixel-level weighting coefficients based on the global grayscale mean and the local sub-block mean; A weighted Gaussian kernel is constructed based on the pixel-level weighting coefficients, and the light components are estimated by convolving the weighted Gaussian kernel with the grayscale image of the cross-shaped marker points. Calculate the logarithmic reflectance component based on the grayscale image of the crosshair markers and the illumination component; The logarithmic reflectance component is exponentially restored to obtain an enhanced image; The enhanced image is subjected to grayscale stretching to output the equalized image.
[0008] Furthermore, the improved EDLines line detection algorithm includes the following steps: Input a grayscale image after equalization processing using the weighted block improved single-scale Retinex algorithm, calculate the gradient magnitude and gradient direction angle of the grayscale image, and filter effective edge tracking anchor points; Starting from each of the effective edge tracking anchor points, edge tracking is performed synchronously in both positive and negative directions to obtain an initial edge chain; Perform curvature filtering on each of the initial edge chains, discarding edge chains with curvature greater than a set value and retaining straight edge chains; Perform cross-end completion processing on each of the straight edge chains to form a complete cross-edge group; Perform least-squares line fitting on each complete cross edge group to obtain the tilt angle of each line; Extract the tilt angles corresponding to all horizontal lines within the cross mark point, and take the average value to obtain the overall tilt angle of the cross mark point.
[0009] Further, calculating the gradient magnitude and gradient direction angle of the grayscale image includes the following steps: The horizontal and vertical gradients are calculated pixel by pixel using a gradient operator, and the gradient magnitude and gradient direction angle are solved based on the horizontal and vertical gradients.
[0010] Further, the effective edge tracking anchor points are selected, including the following steps: Calculate the gradient magnitude of all pixels in the entire image, and set the strong gradient tracking threshold based on the quantiles; Based on the strong gradient tracking threshold, a weak gradient backtracking threshold is set, and pixels with local maxima of gradients and gradient direction deviations of adjacent pixels less than the set value are selected as the effective edge tracking anchor points.
[0011] Further, obtaining the initial edge chain includes the following steps: A bidirectional tracking vector is constructed using the gradient direction of each effective edge tracking anchor point; Simultaneously initiate edge tracking in both positive and negative directions, and retain neighboring pixels whose gradient direction difference does not exceed a set value as candidate extension points; Gradient breakpoint backtracking criterion: If the current pixel gradient is greater than the strong gradient tracking threshold, then continue tracking; If the current pixel gradient is less than the strong gradient tracking threshold, and there is a pixel in the backtracking window that satisfies the strong gradient tracking threshold, then the breakpoint backtracking chain is executed. If the current pixel gradient is less than the weak gradient backtracking threshold, then the current direction tracking is terminated. After bidirectional tracking is completed, the two sub-chains are merged to obtain the initial edge chain.
[0012] Furthermore, the straight edge chains are further processed by cross-end completion to form a complete cross-edge group, including the following steps: Horizontal and vertical edge chains that meet the orthogonal condition are selected as paired chains. The distance between the endpoints of the paired chains is calculated. If the distance is less than a set threshold, the missing pixels in the middle are filled by interpolation to form the complete cross edge group.
[0013] Furthermore, before the motion control module carries the crosshair markings to complete the movement of the galvanometer correction target, the following steps are also included: The step of calibrating the transformation relationship between the acquisition module and the galvanometer coordinate system, wherein the theoretical acquisition reference position is determined based on the transformation relationship.
[0014] Furthermore, the grid density of the crosshair markers is adjustable in multiple levels.
[0015] Furthermore, the galvanometer compensation file includes: The deviation data between the theoretical coordinates and the actual coordinates of each crosshair mark point.
[0016] Compared with the prior art, the above-described solutions of this application have at least the following beneficial effects: 1. This application discloses an automatic galvanometer calibration and compensation method, which involves marking crosshair points, moving a galvanometer calibration target (with the marked crosshair points mounted on a motion module) to the theoretical acquisition reference position of the acquisition module, acquiring the original image, performing grayscale adaptive equalization on the original image using a weighted block improved single-scale Retinex algorithm, separating the foreground region of the crosshair target after removing background noise and scratch interference, extracting horizontal and vertical lines in the foreground region of the crosshair target using an improved EDLines line detection algorithm to calculate the tilt angle of the crosshair points, and controlling the rotation of the motion module based on the tilt angle to complete the attitude correction of the galvanometer calibration target. The process involves: acquiring corrected images of the crosshair markers after posture correction; using an improved EDLines line detection algorithm to extract horizontal and vertical lines from the corrected images to calculate the center coordinates of the crosshair markers; calculating the X-axis and Y-axis position errors based on the center coordinates and theoretical reference coordinates; traversing all crosshair markers and repeating the movement acquisition and calculation steps until all crosshair markers are processed; and generating a galvanometer compensation file based on the position errors of all crosshair markers to complete the galvanometer calibration. This fully automates the galvanometer calibration process, eliminating the need for manual point-by-point measurement and data entry, significantly reducing calibration time, and adapting to unified calibration of batch equipment on production lines.
[0017] 2. The automatic galvanometer calibration and compensation method of this application extracts the horizontal and vertical straight lines of the crosshair markers by using an improved EDLines straight line detection algorithm. Combined with secondary acquisition and position error calculation after θ-axis attitude correction, it achieves high-precision calculation of the tilt angle and center coordinates of the crosshair markers, eliminates the influence of manual reading errors and angle deviation caused by target tilt on the calibration accuracy, and is significantly better than the traditional manual calibration scheme.
[0018] 3. The automatic galvanometer correction and compensation method of this application performs grayscale adaptive equalization processing on the original image by weighted block improvement of the single-scale Retinex algorithm, which eliminates the interference of uneven illumination in the industrial acquisition environment, ensures the accuracy and stability of the edge detection of the cross marker point, and, together with the micron-level mechanical positioning accuracy of the motion module, achieves a significant improvement in the galvanometer correction accuracy, which can meet the process requirements of high-precision laser processing scenarios for the geometric accuracy of the galvanometer surface. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings: Figure 1This is a flowchart illustrating an automatic galvanometer correction and compensation method provided in an embodiment of this application.
[0020] Figure 2 A schematic diagram of an improved Retinex algorithm for an automatic galvanometer correction and compensation method provided in an embodiment of this application.
[0021] Figure 3 A schematic diagram of the improved EDLines algorithm for an automatic galvanometer correction and compensation method provided in an embodiment of this application. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a product or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a product or device. Without further limitation, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the product or device that includes that element.
[0024] The embodiments of this application are described in detail below with reference to the accompanying drawings.
[0025] This application takes 9×9 grid correction as an example, and uses an automatic galvanometer correction and compensation method of this application to correct the galvanometer system of the alloy laser removal machine.
[0026] The galvanometer control system controls the galvanometer scanning module to mark standard points for correction on the galvanometer calibration target using laser light. The galvanometer system of the alloy laser removal machine, as in existing technology, includes: a galvanometer scanning module, a galvanometer calibration module, a galvanometer calibration target, crosshair marking points, an XYθ motion platform, a Y-axis linear motor, an X-axis linear motor, an θ-axis linear motor, a work platform, a CCD image acquisition module, a CCD camera, a camera lens, a camera light source, an image brightness equalization module, a background extraction module, a target recognition module, a motion control module, a position deviation calculation module, a galvanometer compensation file generation module, and a fixed base. This application uses the galvanometer system of an alloy laser removal machine as an example to introduce a specific implementation of an automatic galvanometer calibration and compensation method. This method can also be applied to other existing galvanometer systems, and this application does not limit its application to these systems.
[0027] like Figure 1 , Figure 2 and Figure 3 As shown in the figure, this application provides an automatic galvanometer correction and compensation method, which includes the following steps: S1. Control the galvanometer scanning module to mark crosshair points with a grid distribution on the surface of the galvanometer calibration target.
[0028] In this embodiment, the galvanometer control system controls the laser beam deflection via the galvanometer scanning module to mark crosshair markers in a grid pattern on the surface of the galvanometer calibration target. The crosshair markers can be cross shapes, but dots or other feature shapes can also be used; this embodiment uses a cross shape as an example. The grid density of the crosshair markers is adjustable in multiple levels; this embodiment uses a 9×9 grid, marking a total of 81 crosshair markers, with a theoretical spacing of 8.750 mm between adjacent crosshair markers. The galvanometer calibration target is made of a thin metal plate. During marking, the laser parameters are preset by the operator according to the actual material type and thickness. This embodiment uses a 9×9 grid for calibration, but 3×3, 5×5, or 17×17 grids can also be selected as needed. A 17×17 grid can achieve 289-point fine calibration. The calibration accuracy is directly proportional to the number of markers; the more markers, the more accurate the generated calibration compensation.
[0029] S2. The motion control module carries the galvanometer correction target motion that completes the marking of the crosshair mark, so that the crosshair mark to be detected is moved to the theoretical acquisition reference position of the acquisition module.
[0030] In this embodiment, a galvanometer calibration target marked with 81 crosshair points is fixedly mounted on the working platform of the XYθ motion platform. The XYθ motion platform includes a Y-axis linear motor, an X-axis linear motor, a θ-axis linear motor, and a working platform. The Y-axis linear motor is positioned in the Y-direction of the planar coordinate system, the X-axis linear motor is positioned in the X-direction and above the Y-axis linear motor, the θ-axis linear motor is positioned above the X-axis linear motor, and the working platform is positioned above the θ-axis linear motor. All three linear motors are directly driven by linear motors, eliminating intermediate transmission links and removing the backlash and elastic deformation present in lead screw transmission mechanisms, thus ensuring positioning accuracy and repeatability. The mechanical positioning accuracy of the XYθ motion platform is 1 μm. The motion control module drives the X-axis and Y-axis linear motors to move the currently detected crosshair point on the galvanometer calibration target to the theoretical acquisition reference position of the CCD image acquisition module.
[0031] The technical solution of this application embodiment provides a preferred technical solution. Before executing S2, a step is performed to calibrate the transformation relationship between the acquisition module and the galvanometer coordinate system. In this embodiment, a nine-point calibration method is used to establish the transformation relationship between the CCD camera pixel coordinate system and the galvanometer coordinate system. Nine reference points are marked on the surface of the galvanometer calibration target in a grid arrangement. The CCD camera sequentially acquires images of each reference point. The coordinates of each reference point in the pixel coordinate system are obtained through image processing. Combined with the theoretical coordinates of each reference point in the galvanometer coordinate system, the transformation matrix H between the pixel coordinate system and the galvanometer coordinate system is calculated. The transformation matrix H is a 3×3 homography matrix. The theoretical acquisition reference position is the pixel position corresponding to the theoretical coordinates of the crosshair mark in the galvanometer coordinate system after being mapped to the pixel coordinate system by the transformation matrix H. The step of calibrating the transformation relationship between the acquisition module and the galvanometer coordinate system ensures that the image coordinates acquired by the CCD camera can be accurately converted into spatial coordinates in the galvanometer coordinate system, ensuring the spatial positioning accuracy of the crosshair mark and laying the foundation for subsequent position error calculation.
[0032] S3. Acquire the original image of the current crosshair marker point.
[0033] In this embodiment, the CCD image acquisition module acquires the original image of the current crosshair marker. The CCD image acquisition module is mounted above the XYθ motion platform and includes a CCD camera, a camera lens, and a camera light source. One end of the camera lens is fixed to one end of the CCD camera, the side of the CCD camera is fixedly mounted on a fixed base, and the camera light source is fixedly mounted on the fixed base to provide illumination for the CCD camera to acquire images. After acquiring the original image of the current crosshair marker, the CCD image acquisition module transmits the original image to the image brightness equalization module.
[0034] S4. The original image is subjected to grayscale adaptive equalization using the weighted block improved single-scale Retinex algorithm to obtain an equalized image.
[0035] In this embodiment, the image brightness equalization module performs a weighted block-based improved single-scale Retinex algorithm on the input original image. In the embodiments of this application,
[0036] The specific processing steps of the weighted block-based improved single-scale Retinex algorithm are as follows: S401. The original image is used as a grayscale image of the crosshair markers and normalized to the grayscale range.
[0037] The original image is used as a grayscale image I(x,y) of the crosshair markers, and normalized to the grayscale range of [0,1]. In this embodiment, the original image is a grayscale image captured by a CCD camera. Wherein, I(x,y) represents the normalized grayscale image of the crosshair markers; x represents the horizontal coordinate of the image pixel; and y represents the vertical coordinate of the image pixel.
[0038] S402. The input image I(x,y) is composed of the product of the illumination component L(x,y) and the reflection component R(x,y), and its expression is: in, R(x,y) represents the input image; R(x,y) represents the reflection component of the object, reflecting the image information of the object itself; L(x,y) represents the ambient light component, reflecting the ambient lighting conditions when the image was acquired.
[0039] After conversion to the logarithmic field, the expression is: in, Represents the logarithmic reflection component; Represents a logarithmic input image; This represents the logarithmic ambient light component.
[0040] S403. Calculate the global grayscale mean of the entire grayscale image I(x,y) of the crosshair marker points. The expression is: in, H represents the global grayscale mean of the entire image; H represents the image height in pixels; W represents the image width in pixels.
[0041] S404. Using a sliding window S×S, traverse the entire grayscale image I(x,y) of the crosshair marker points and calculate the local sub-block mean pixel by pixel. The expression is: Where S represents the sliding window size; It represents the average grayscale value of all pixels within a local sub-block centered at pixel (x,y).
[0042] S405, Based on the global grayscale average value and the mean of the local sub-blocks The pixel-level weighting coefficients are calculated using the following expression: in, This represents the mean of a local sub-block; This represents the weighting coefficient at the pixel (x, y) position.
[0043] When the local sub-block mean Greater than the global grayscale mean When, the weighting coefficient at pixel (x,y) position A value greater than 1 indicates that the area has strong illumination and needs to be enhanced accordingly; when the local sub-block average is... Less than the global grayscale mean At that time, weighting coefficient A value less than 1 indicates that the area has weak lighting and needs to be reduced accordingly.
[0044] S406, Based on the pixel-level weighting coefficients Constructing a weighted Gaussian kernel The weighted Gaussian kernel The illumination component is estimated by convolving the grayscale image I(x,y) with the cross-marked points. .
[0045] Weighted Gaussian kernel The construction formula is expressed as: in, Indicates a weighted Gaussian kernel; This represents the original Gaussian kernel.
[0046] Estimating illumination components The expression is: Where * represents convolution operation; This represents the illumination component estimated at the pixel (x, y) position.
[0047] S407. Based on the grayscale image I(x,y) of the crosshair marker and the illumination component... Calculate the logarithmic reflection component The expression is: S408, Regarding the logarithmic reflection component Exponential restoration is performed to obtain the enhanced image. .
[0048] in, This represents the enhanced image grayscale value at pixel (x, y).
[0049] S409, the enhanced image Stretch the grayscale to the 0-255 grayscale range and output the equalized image. The expression is: in, The equalized image gray value at pixel (x, y); Indicates enhanced image The minimum grayscale value; Indicates enhanced image The maximum grayscale value.
[0050] The technical solution of this application adopts a weighted block improved single-scale Retinex algorithm. It constructs a weighted Gaussian kernel by using pixel-level weighting coefficients of global gray-level mean and local sub-block mean. It adaptively estimates the illumination component and eliminates the interference of uneven illumination, so as to equalize the gray level of the cross-mark point image and improve the accuracy and stability of subsequent edge detection.
[0051] S5. Remove background noise and scratch interference from the equalized image and separate the foreground region of the cross-shaped target.
[0052] In this embodiment of the application, the background extraction module is used to equalize the image. Perform the following processing: Use median filter to remove equalization image Isolated noise points in the image are identified. Then, an adaptive thresholding method is used to calculate the binarization threshold on the median-filtered image, dividing the image pixels into foreground and background categories based on their grayscale values, resulting in a binarized image. Pixels with grayscale values greater than the threshold are classified as foreground regions of the cross-shaped target, while pixels with grayscale values less than or equal to the threshold are classified as background regions. Finally, morphological opening operations are used to remove scratch interference from the binarized image. The opening operation involves erosion followed by dilation to obtain the foreground region of the cross-shaped target. .
[0053] S6. Using the improved EDLines line detection algorithm, extract the horizontal and vertical lines in the foreground region of the cross target, and calculate the tilt angle of the cross marker point.
[0054] In this embodiment of the application, the target recognition module identifies the foreground region of the cross-shaped target. The improved EDLines line detection algorithm is executed. The specific processing steps are as follows: Input a grayscale image processed by a weighted block-based improved single-scale Retinex algorithm equalization, and perform noise removal and foreground separation on the grayscale foreground image. Calculate the grayscale image The gradient magnitude and gradient direction angle are used to filter valid edge tracking anchor points.
[0055] The specific steps for calculating the gradient magnitude and gradient direction angle are as follows: The horizontal gradient is calculated pixel-by-pixel using the 3×3 Sobel operator. and vertical gradient Solve for gradient magnitude and gradient direction angle The expression is: Expand all pixel gradients into a one-dimensional array. Sort all pixel gradients from smallest to largest to obtain an ordered gradient sequence: Based on the index corresponding to the quantile Calculate the strong gradient tracking threshold , Then calculate the weak gradient backtracking threshold. , Filter for local maxima in gradients, selecting pixels whose gradient direction deviation is less than a threshold. The pixels are used as effective edge tracking anchor points. This indicates the floor function; N represents the total number of gradients across all pixels in the image. p In this embodiment of the application, the set quantile is indicated. .
[0056] Traverse each valid anchor point Construct a bidirectional tracking vector using the anchor point gradient direction angle. and .
[0057] in, This represents the gradient direction angle at the effective edge tracking anchor point; Indicates the angle along the gradient direction. Constructed positive tracking vector; Represents the reverse tracking vector, and In the opposite direction; This represents the vertical component of the positive tracking vector; This represents the horizontal component of the positive tracking vector.
[0058] The original EDLines algorithm only employs a unidirectional tracking mechanism, extending in only one direction after detecting the edge origin. It lacks the ability to simultaneously construct both forward and reverse vectors and extend in parallel at both ends. When the edge origin is located at the crosshair endpoint, unidirectional tracking can only capture one arm of the crosshair, failing to obtain complete crosshair edge information. The technical solution of this application constructs forward and reverse tracking vectors using the gradient direction angle of the effective edge tracking anchor point, simultaneously initiating edge tracking in both directions. By constructing bidirectional tracking vectors to achieve synchronous parallel extension at both ends, it can simultaneously acquire the complete edge pixels of the horizontal and vertical arms of the crosshair marker point during a single tracking process, providing a complete edge data foundation for subsequent crosshair endpoint completion processing and tilt angle calculation. This bidirectional tracking feature differs from conventional tracking direction parameter adjustments and is not simply parameter optimization, representing a substantial improvement in edge tracking strategies. Extending bidirectional tracking to multidirectional tracking, such as four- or eight-directional tracking, will multiply the computational load and significantly reduce the real-time image processing speed, hindering high-speed batch correction on production lines. Furthermore, multidirectional tracking easily captures the horizontal and vertical edges of adjacent crosshair markers across line segments, splicing two orthogonal edges that do not belong to the same crosshair marker into a chaotic chain. This directly leads to a surge in post-processing pressure for curvature filtering and orthogonal pairing, making it highly susceptible to identifying false crosses and ultimately reducing the detection accuracy of crosshair markers. Therefore, adopting a strategy of bidirectional tracking vectors with parallel extension at both ends ensures the integrity of crosshair edge detection while balancing computational efficiency and detection accuracy.
[0059] Edge tracking is initiated simultaneously in both positive and negative directions; during tracking, only the gradient direction difference is retained and does not exceed [a certain value]. The four neighboring pixels are used as candidate extension points.
[0060] The tracking process executes a gradient breakpoint backtracking criterion. Let the gradient of the current pixel be... .like If so, the tracking continues normally; if And there exists a strong gradient tracking threshold within the backtracking window. For pixels, the breakpoint backtracking is executed to continue the chain; if If the current direction tracking is terminated, the two sub-chains will be merged after bidirectional tracking is completed to obtain the initial edge chain. .in, This represents the complete initial edge chain after the merger; Indicates reverse tracing of the subchain; This indicates the forward tracking subchain. That is, starting from each of the effective edge tracking anchor points, edge tracking is performed synchronously in both forward and reverse directions to obtain the initial edge chain.
[0061] The local discrete curvature of the edge chain is calculated segment by segment using a sliding window, and the expression is: in, This represents the curvature value at the i-th pixel on the edge chain; It represents the first derivative of the x-coordinate at the i-th pixel with respect to the arc length, i.e., the rate of change in the horizontal direction; It represents the first derivative of the y-coordinate at the i-th pixel with respect to the arc length, i.e., the rate of change in the vertical direction; This represents the second derivative of the x-coordinate at the i-th pixel with respect to the arc length; Let represent the second derivative of the y-coordinate at the i-th pixel with respect to the arc length.
[0062] Curvature filtering is performed on each of the initial edge chains. If the curvature is greater than a curvature threshold... Then remove the edge chain and keep the straight edge chain.
[0063] Perform cross-end completion processing on all retained straight edge chains: Filter out edge chains whose angles satisfy the orthogonal condition: Horizontal and vertical pairing chains within the range. Indicates the angle of the first edge chain; This indicates the angle of the second edge chain.
[0064] The Euclidean distance between the endpoints of the chain is calculated using the following expression: in, This represents the Euclidean distance between points A and B. , These represent the pixel coordinates of endpoint A; , These represent the pixel coordinates of endpoint B.
[0065] like If the pixel size is less than 3 pixels, then linear interpolation is used to fill in the missing pixels in the middle to form a complete cross-shaped edge group. The expression is: in, The coordinates of the interpolation point are represented; t represents the interpolation parameter, which has a value range of [0,1].
[0066] For each complete cross-shaped edge group, perform least-squares line fitting on all discrete pixels, and substitute the values into the slope and intercept formulas to obtain the slope k and intercept b of each line. Then, through... Calculate the tilt angle of a single straight line relative to the horizontal axis of the image. Wherein, This indicates the tilt angle of a single straight line relative to the horizontal axis of the image.
[0067] Extract the tilt angles corresponding to all horizontal lines within the crosshair marker, and take the average value to obtain the overall tilt angle of the crosshair marker. The expression is: in, M represents the overall tilt angle of the crosshair markers; M represents the total number of crosshair markers. This indicates the angle of inclination of the horizontal line within the j-th crosshair mark.
[0068] S7. Control the motion module to rotate according to the tilt angle to complete the attitude correction of the galvanometer correction target.
[0069] In this embodiment, the motion control module calculates the overall tilt angle based on the target recognition module. Drive the θ-axis linear motor to rotate Angle. The θ-axis linear motor drives the work platform to rotate the galvanometer calibration target, thus correcting the target's attitude.
[0070] S8. Acquire the corrected image of the crosshair markers after attitude correction.
[0071] In this embodiment of the application, after the θ-axis linear motor has rotated, the CCD image acquisition module re-acquires the corrected image of the current crosshair mark point after attitude correction.
[0072] S9. Use the improved EDLines line detection algorithm to extract the horizontal and vertical lines in the corrected image, and calculate the center coordinates of the cross marker points.
[0073] In this embodiment, the target recognition module performs the same improved EDLines line detection algorithm as step S6 on the corrected image. It extracts all horizontal and vertical lines from the current crosshair mark in the corrected image. The center position of the horizontal lines is calculated. and the center position of the vertical line The average value of the center positions of the horizontal and vertical lines is taken as the center coordinates of the crosshair marker. .
[0074] S10. Based on the center coordinates and theoretical reference coordinates Calculate the positional errors in the X and Y axes.
[0075] In this embodiment, the position deviation calculation module reads the theoretical reference coordinates of the current crosshair mark point. The position deviation calculation module calculates the center coordinates. With theoretical reference coordinates The difference is used to obtain the position error ΔX in the X-axis direction and the position error ΔY in the Y-axis direction.
[0076] S11. Traverse each cross mark on the galvanometer calibration target, repeat the movement, acquisition and calculation steps until all cross marks are processed.
[0077] In this embodiment, the motion control module traverses all the crosshair markers on the galvanometer calibration target, sequentially executing steps S2 to S10. Each crosshair marker is moved sequentially to the theoretical acquisition reference position of the CCD image acquisition module. The module then acquires the original image, performs grayscale adaptive equalization using a weighted block-based improved single-scale Retinex algorithm, removes background noise and scratch interference to separate the foreground region of the crosshair target, detects the tilt angle using an improved EDLines line detection algorithm, drives the θ-axis linear motor for attitude correction, acquires the corrected image, calculates the center coordinates using the improved EDLines line detection algorithm, and calculates the X-axis and Y-axis position errors. This process continues until all crosshair markers are processed, obtaining the X-axis position error of all crosshair markers. and Y-axis position error The difference, i = 1, 2, ..., m, where m represents the total number of crosshair markers. In this embodiment, m = 81, resulting in 81 sets of X-axis position errors. and Y-axis position error .
[0078] S12. After all crosshair markers have been processed, a galvanometer compensation file is generated based on the positional error of all crosshair markers. The galvanometer is then calibrated according to the galvanometer compensation file.
[0079] In this embodiment, the galvanometer compensation file generation module integrates the position error data of all crosshair markers to generate a galvanometer compensation file. The galvanometer compensation file contains the deviation data between the theoretical and actual coordinates of each crosshair marker. Specifically, the galvanometer compensation file is a .cor format file, and its content includes: a file header, the theoretical coordinates of each crosshair marker, and the corresponding X-axis position error. Y-axis position error The galvanometer compensation file generation module generates the compensation value for each grid region using an interpolation algorithm. The galvanometer compensation file is then sent to the galvanometer control system. The galvanometer control system loads the compensation file and, based on the deviation data in the compensation file, compensates for and corrects the laser beam deflection at each point in the galvanometer scanning path, thus completing the galvanometer calibration.
[0080] In this embodiment, after all 81 crosshair marks (9×9) on the galvanometer calibration target were collected and processed, the accuracy before and after calibration was verified. The measurement method was as follows: nine straight line segments were taken along the horizontal direction on the galvanometer calibration target, and the lengths of each straight line segment were measured before and after calibration; simultaneously, nine points were taken along the horizontal direction, and the positional deviations of each point were measured before and after calibration. The measurement data are shown in Tables 1 and 2. Table 1. Straight Segment Length Data Table 2 shows the single-point deviation data (horizontal line). Based on the above data verification, after calibrating the galvanometer system using the automatic galvanometer calibration and compensation method of this application, the maximum deviation of the straight segment length decreased from 52 μm before calibration to 4 μm after calibration, and the maximum deviation of a single point decreased from 23 μm before calibration to 2 μm after calibration. The grid pattern marked on the galvanometer calibration target changed from a trapezoidal shape before calibration to a regular rectangle after calibration. The laser beam deflection accuracy of the galvanometer scanning module was significantly improved after calibration, meeting the process requirements for the geometric accuracy of the galvanometer surface in high-precision laser processing scenarios.
[0081] The automatic galvanometer correction and compensation method provided in this application involves a galvanometer scanning module marking a grid of crosshair points on the surface of a galvanometer correction target. A motion module carries the galvanometer correction target, moving the marked crosshair points to the theoretical acquisition reference position of the acquisition module. The acquisition module acquires the original image of the current crosshair point. An image brightness equalization module uses a weighted block improved single-scale Retinex algorithm to perform grayscale adaptive equalization on the original image to eliminate uneven illumination interference. A background extraction module removes background noise and scratch interference and separates the foreground region of the crosshair target. A target recognition module uses an improved EDLines line detection algorithm to extract horizontal and vertical lines from the foreground region of the crosshair target to calculate the crosshair mark. The tilt angle of the point is controlled by the motion control module to rotate the motion module to complete the attitude correction of the galvanometer calibration target. The acquisition module acquires the corrected image of the cross marker point after attitude correction. The target recognition module uses the improved EDLines line detection algorithm to extract the horizontal and vertical lines in the corrected image to calculate the center coordinates of the cross marker point. The position deviation calculation module calculates the position error in the X and Y axes based on the center coordinates and the theoretical reference coordinates. The above movement, acquisition and calculation steps are repeated for each cross marker point on the galvanometer calibration target until all cross marker points are processed. The galvanometer compensation file generation module generates a galvanometer compensation file based on the position error of all cross marker points and sends it to the galvanometer control module to complete the galvanometer calibration. This application achieves full automation of galvanometer calibration by using a three-axis XYθ precision motion platform, a weighted block improved single-scale Retinex illumination equalization algorithm, and an improved EDLines line detection algorithm. This eliminates human error. The maximum deviation of a single point before calibration was 23μm, and the error of a single point after calibration was controlled within 2μm. The error of the length of the calibrated line was reduced from 52μm before calibration to 4μm. This significantly improves the accuracy and efficiency of galvanometer calibration and can be widely used in high-precision laser processing scenarios.
[0082] Finally, it should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems or apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to the method section.
[0083] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for automatic galvanometer correction and compensation, characterized in that, Includes the following steps: The galvanometer scanning module is controlled to mark crosshair points with a grid distribution on the surface of the galvanometer calibration target; The motion control module carries the galvanometer calibration target that completes the marking of the crosshair mark, so that the crosshair mark to be detected is moved to the theoretical acquisition reference position of the acquisition module; Acquire the original image of the current crosshair marker point; The original image is subjected to grayscale adaptive equalization using a weighted block-based improved single-scale Retinex algorithm to obtain an equalized image. Background noise and scratch interference are removed from the equalized image to separate the foreground region of the cross-shaped target; An improved EDLines line detection algorithm is used to extract horizontal and vertical lines in the foreground region of the cross-shaped target, and the tilt angle of the cross-shaped marker point is calculated. The motion module is controlled to rotate according to the tilt angle to complete the attitude correction of the galvanometer correction target; Acquire corrected images of the crosshair markers after attitude correction; The improved EDLines line detection algorithm is used to extract horizontal and vertical lines from the corrected image, and the center coordinates of the crosshair markers are calculated. Calculate the X-axis and Y-axis position errors based on the center coordinates and the theoretical reference coordinates; The process involves iterating through each crosshair mark on the galvanometer calibration target, repeating the movement, acquisition, and calculation steps until all crosshair marks have been processed. After all crosshair markers have been processed, a galvanometer compensation file is generated based on the positional errors of all crosshair markers. The galvanometer calibration is then completed based on the galvanometer compensation file.
2. The method according to claim 1, characterized in that, The weighted block-based improved single-scale Retinex algorithm includes the following steps: The original image is used as a grayscale image of the crosshair markers and normalized to the grayscale range. Calculate the global grayscale mean of the entire grayscale image of the crosshair markers; A sliding window is used to traverse the entire grayscale image of the crosshair markers, and the mean value of local sub-blocks is calculated pixel by pixel. Calculate pixel-level weighting coefficients based on the global grayscale mean and the local sub-block mean; A weighted Gaussian kernel is constructed based on the pixel-level weighting coefficients, and the light components are estimated by convolving the weighted Gaussian kernel with the grayscale image of the cross-shaped marker points. Calculate the logarithmic reflectance component based on the grayscale image of the crosshair markers and the illumination component; The logarithmic reflectance component is exponentially restored to obtain an enhanced image; The enhanced image is subjected to grayscale stretching to output the equalized image.
3. The method according to claim 1, characterized in that, The improved EDLines line detection algorithm includes the following steps: Input a grayscale image after equalization processing using the weighted block improved single-scale Retinex algorithm, calculate the gradient magnitude and gradient direction angle of the grayscale image, and filter effective edge tracking anchor points; Starting from each of the effective edge tracking anchor points, edge tracking is performed synchronously in both positive and negative directions to obtain an initial edge chain; Perform curvature filtering on each of the initial edge chains, discarding edge chains with curvature greater than a set value and retaining straight edge chains; Perform cross-end completion processing on each of the straight edge chains to form a complete cross-edge group; Perform least-squares line fitting on each complete cross edge group to obtain the tilt angle of each line; Extract the tilt angles corresponding to all horizontal lines within the cross mark point, and take the average value to obtain the overall tilt angle of the cross mark point.
4. The method according to claim 3, characterized in that, Calculating the gradient magnitude and gradient direction angle of the grayscale image includes the following steps: The horizontal and vertical gradients are calculated pixel by pixel using a gradient operator, and the gradient magnitude and gradient direction angle are solved based on the horizontal and vertical gradients.
5. The method according to claim 3, characterized in that, Filtering the valid edge tracking anchor points includes the following steps: Calculate the gradient magnitude of all pixels in the entire image, and set the strong gradient tracking threshold based on the quantiles; Based on the strong gradient tracking threshold, a weak gradient backtracking threshold is set, and pixels with local maxima of gradients and gradient direction deviations of adjacent pixels less than the set value are selected as the effective edge tracking anchor points.
6. The method according to claim 3, characterized in that, Obtaining the initial edge chain includes the following steps: A bidirectional tracking vector is constructed using the gradient direction of each effective edge tracking anchor point; Simultaneously initiate edge tracking in both positive and negative directions, and retain neighboring pixels whose gradient direction difference does not exceed a set value as candidate extension points; Gradient breakpoint backtracking criterion: If the current pixel gradient is greater than the strong gradient tracking threshold, then continue tracking; If the current pixel gradient is less than the strong gradient tracking threshold, and there is a pixel in the backtracking window that satisfies the strong gradient tracking threshold, then the breakpoint backtracking chain is executed. If the current pixel gradient is less than the weak gradient backtracking threshold, then the current direction tracking is terminated. After bidirectional tracking is completed, the two sub-chains are merged to obtain the initial edge chain.
7. The method according to claim 3, characterized in that, Perform cross-end completion processing on each of the straight edge chains to form a complete cross-edge group, including the following steps: Horizontal and vertical edge chains that meet the orthogonal condition are selected as paired chains. The distance between the endpoints of the paired chains is calculated. If the distance is less than a set threshold, the missing pixels in the middle are filled by interpolation to form the complete cross edge group.
8. The method according to claim 1, characterized in that, Before the motion control module carries the galvanometer correction target to complete the crosshair marking, the following steps are also included: The step of calibrating the transformation relationship between the acquisition module and the galvanometer coordinate system, wherein the theoretical acquisition reference position is determined based on the transformation relationship.
9. The method according to claim 1, characterized in that, The grid density of the crosshair markers is adjustable in multiple levels.
10. The method according to claim 1, characterized in that, The galvanometer compensation file includes: The deviation data between the theoretical coordinates and the actual coordinates of each crosshair mark point.