Laser positioning method and system based on X-ray imaging and affine transformation compensation
By using a method based on X-ray imaging and affine transformation compensation, the affine distortion problem between the coordinate systems of the X-ray imaging system and the laser equipment was solved, achieving sub-pixel accuracy in laser positioning, which is suitable for internal target positioning in complex industrial scenarios.
Patent Information
- Application Number
- CN202510982533.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-16
- Publication Date
- 2025-11-04
AI Technical Summary
In existing technologies, there is affine distortion between the coordinate systems of X-ray imaging systems and laser devices, resulting in insufficient laser positioning accuracy, especially in complex industrial scenarios where it is difficult to achieve sub-pixel-level internal target positioning.
A method based on X-ray imaging and affine transformation compensation is adopted. By extracting internal feature points of the product, an affine transformation model is established, and the transformation parameters are solved using the least squares method. The coordinate deviation of the laser equipment is corrected in real time, and the model parameters are optimized by combining an adaptive learning mechanism.
It achieves sub-pixel accuracy in laser positioning, is suitable for complex industrial scenarios, improves the positioning accuracy of internal targets, is compatible with non-orthogonal coordinate systems and irregular deformations, and is suitable for electronic component packaging and precision mold processing.
Smart Images

Figure CN120890366A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial precision machining technology, and in particular to a laser positioning method and system based on X-ray imaging and affine transformation compensation. Background Technology
[0002] In precision manufacturing, laser marking relies on high-precision positioning of surface or internal features of a product. However, due to product assembly tolerances, material deformation, or occlusion, externally visible features cannot directly guide laser processing of internal targets. Traditional optical positioning methods have limitations, while X-ray imaging can penetrate objects to obtain internal structural information, but the coordinate system deviation between the imaging system and the laser equipment needs dynamic compensation. In existing technologies, coordinate transformation algorithms are mostly based on rigid transformations, which do not fully optimize the nonlinear errors under affine degrees of freedom. Therefore, a dynamic compensation method based on an affine transformation mathematical model is urgently needed to improve laser positioning accuracy. Summary of the Invention
[0003] The purpose of this invention is to provide a laser positioning method and system based on X-ray imaging and affine transformation compensation, so as to solve the positioning deviation caused by affine distortion between the coordinate system of the X-ray imaging system and the coordinate system of the laser device, such as translation, rotation, scaling and shearing, and achieve sub-pixel level compensation accuracy.
[0004] To achieve the above objectives, the following technical solution is adopted: A laser positioning method based on X-ray imaging and affine transformation compensation includes the following steps: S1: Obtain an image of the product's internal features and extract the actual coordinates of at least three feature points from the image. ; S2: Establish actual coordinates With theoretical coordinates The affine transformation model between them is given by the following formula: ; S3: Solve for the transformation parameter vector of the affine transformation model using the least squares method. To minimize the sum of squared residuals between theoretical and actual coordinates: ; S4: Set the theoretical target coordinates of the laser device Substitute into the affine transformation model and output the compensated physical coordinates. Then, based on the compensated physical coordinates, the laser head is driven to move to the corrected position.
[0005] Furthermore, in step S1, when extracting image feature points, the calibration block feature circle is first extracted. The specific steps are as follows: The image is binarized, and pixels with gray values greater than a preset gray value threshold are set to white, while those with gray values less than a preset gray value threshold are set to black. Use a contour detection algorithm to perform contour detection on the binarized image; By determining the circularity threshold and area range, the smallest closed circle is drawn, and the largest circle is determined as the target feature circle.
[0006] Furthermore, the steps for extracting image feature points specifically include: Image noise is removed using median filtering and bilateral filtering, and image edges are detected using the Sobel operator. Detect contours in an image and filter out contours of interest based on their area; The detected feature points are sorted, and their spacing is analyzed to determine whether the expected arrangement conditions are met. Calculate the average position of the feature points and use it as the center position of the feature points.
[0007] Furthermore, the arrangement condition is 3 rows and 3 columns.
[0008] A laser positioning system based on X-ray imaging and affine transformation compensation is also provided, which uses the above-mentioned method for laser positioning, including... The X-ray imaging module, including an X-ray emitter and a flat panel detector, is used to acquire images of the internal features of a product. A laser head is used to perform laser marking based on coordinates compensated by affine transformation. The control module, connected to the X-ray imaging module and laser head, is used to control the positioning and marking operations of the laser head.
[0009] Furthermore, the control module includes The feature point extraction unit is used to extract feature points from the image. Affine transformation calculation unit, used to establish affine transformation models and solve for transformation parameters; The coordinate compensation unit is used to map the target coordinates to the laser device coordinate system through an affine transformation.
[0010] By adopting the above solution, the beneficial effects of the present invention are: This invention achieves four-degree-of-freedom error compensation (translation, rotation, scaling, and shearing) through an affine transformation model, achieving sub-pixel level positioning accuracy and significantly improving the accuracy of laser processing of internal targets. Furthermore, it is compatible with non-orthogonal coordinate systems and irregular deformations, making it suitable for complex industrial scenarios such as electronic component packaging and precision mold processing, with a wide range of applications. Attached Figure Description
[0011] Figure 1 This is a flowchart of the method of the present invention; Figure 2This is a schematic diagram of the affine transformation compensation process of the present invention; Figure 3 This is a mathematical flowchart of the present invention based on least squares matrix solving; Figure 4 In one embodiment of the present invention, the image of the first feature point used in the affine transformation matrix calculation; Figure 5 In one embodiment of the present invention, the image of the second feature point used in the affine transformation matrix calculation; Figure 6 In one embodiment of the present invention, the image of the third feature point used in the affine transformation matrix calculation; Figure 7 An image of the identified feature points, as shown in one embodiment of the present invention; Figure 8 This is an image of the target feature points in one embodiment of the present invention. Detailed Implementation
[0012] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0013] Reference Figures 1 to 8 As shown, this invention provides a laser positioning method based on X-ray imaging and affine transformation compensation, comprising the following steps: S1: Obtain an image of the product's internal features and extract the actual coordinates of at least three feature points from the image. ; In step S1, when extracting image feature points, the calibration block feature circle is first extracted. The specific steps are as follows: The image is binarized, and pixels with gray values greater than a preset gray value threshold are set to white, while those with gray values less than a preset gray value threshold are set to black. Use a contour detection algorithm to perform contour detection on the binarized image; By determining the circularity threshold and area range, the smallest closed circle is drawn, and the largest circle is determined as the target feature circle. Meanwhile, the steps for extracting image feature points specifically include: Image noise is removed using median filtering and bilateral filtering, and image edges are detected using the Sobel operator. Detect contours in an image and filter out contours of interest based on their area; The detected feature points are sorted, and their spacing is analyzed to determine whether the expected arrangement conditions (3 rows and 3 columns) are met. Calculate the average position of the feature points and use it as the center position of the feature points.
[0014] In this step, after acquiring the internal feature image of the product, the image is first preprocessed to enhance its quality and facilitate subsequent feature point extraction. The preprocessing steps include: Denoising: Use methods such as median filtering or bilateral filtering to remove noise from the image while preserving the edge details of the image; Contrast enhancement: By using histogram equalization or adaptive contrast enhancement algorithms, the contrast of the image is improved, making feature points more prominent.
[0015] The extraction of feature points involves the following steps: Edge detection: Use the Sobel or Canny operator to detect image edges and extract edge contours; Contour extraction: Contour detection algorithms (such as findContours in OpenCV) are used to extract contours in the image, and contours of interest are selected based on features such as area and shape. Feature point selection: Select representative feature points from the filtered contours, such as the center point, corner points, or feature points of specific shapes. For complex internal structures of products, deep learning algorithms (such as convolutional neural networks) can be used for feature point identification and classification.
[0016] S2: Establish actual coordinates With theoretical coordinates The affine transformation model between them is given by the following formula: ,in, x , y For actual coordinates, x ′、 y ′ is the theoretical coordinate. a , b , c , d , e , f These are the affine transformation parameters.
[0017] S3: Solve for the transformation parameter vector of the affine transformation model using the least squares method. To minimize the sum of squared residuals between theoretical and actual coordinates: .
[0018] S4: Set the theoretical target coordinates of the laser device Substitute into the affine transformation model and output the compensated physical coordinates. Then, based on the compensated physical coordinates, the laser head is driven to move to the corrected position for laser processing. During the movement of the laser head, its position and attitude need to be monitored in real time to ensure that it moves accurately along the predetermined trajectory. At the same time, an adaptive online learning mechanism can be introduced: during the laser processing, the deviation data between the actual processing position and the theoretical target position is collected in real time and input into the system as feedback information. By analyzing these deviation data, the shortcomings of the model can be identified in a timely manner and adjusted and optimized. For example, online learning algorithms (such as recursive least squares method and Kalman filtering) can be used to dynamically update the parameters of the affine transformation model. Based on the real-time feedback data, the model parameters are gradually adjusted so that it can adapt to changes in products and equipment and maintain high precision in laser positioning.
[0019] In addition, a laser positioning system based on X-ray imaging and affine transformation compensation is provided, which uses the above-mentioned method for laser positioning, including... The X-ray imaging module, including an X-ray emitter and a flat panel detector, is used to acquire images of the internal features of a product. A laser head is used to perform laser marking based on coordinates compensated by affine transformation. The control module, connected to the X-ray imaging module and laser head, is used to control the positioning and marking operations of the laser head.
[0020] The control module includes The feature point extraction unit is used to extract feature points from the image. Affine transformation calculation unit, used to establish affine transformation models and solve for transformation parameters; The coordinate compensation unit is used to map the target coordinates to the laser device coordinate system through an affine transformation.
[0021] In this system, the X-ray imaging module consists of an X-ray emitter and a flat panel detector. The X-ray emitter emits X-rays towards the product to be processed, which are then captured by the flat panel detector to form a high-resolution digital image of the product's internal structure. This module uses a high-sensitivity flat panel detector to ensure image clarity and is suitable for detecting complex internal structures, such as solder joints of electronic components or internal features of precision molds. During image acquisition, the system can balance image quality and radiation safety by optimizing the X-ray dose and imaging parameters.
[0022] The control module is the core processing unit of the system, connected to the X-ray imaging module and laser head via a high-speed data interface. It is responsible for image processing, coordinate transformation, and laser head control. The control module includes the following sub-units: Feature point extraction unit: After receiving the X-ray image, it performs preprocessing operations, including median filtering and bilateral filtering to remove noise, and histogram equalization to enhance contrast. Subsequently, it uses the Sobel operator to detect image edges and extracts contours of interest using a contour detection algorithm (such as findContours in OpenCV). Feature points are selected from the contours, ensuring they meet preset arrangement conditions (such as a 3x3 grid), and their average position is calculated as the center coordinates.
[0023] Affine transformation calculation unit: Constructs an affine transformation model based on the extracted actual and theoretical coordinates of feature points. The parameter vector is then solved using the least squares method to minimize the sum of squared residuals. To improve robustness, the RANSAC algorithm can be used to remove outliers.
[0024] Coordinate compensation unit: Substitutes the theoretical target coordinates of the laser device into the affine transformation model, calculates the compensated physical coordinates, and transmits them to the laser head to drive it to move to the precise position.
[0025] The laser head performs laser marking operations based on the compensated physical coordinates. The laser head is equipped with a high-precision servo motor to ensure the accuracy of the movement trajectory. The system supports multiple laser types (such as fiber lasers or CO2 lasers) and the laser parameters can be adjusted according to the product material and processing requirements.
[0026] In addition, to enhance the system's creativity and usability, the following optimizations and improvements have been integrated into the system: 1) Calibration module and quick product switchover The system includes a calibration module that performs initial calibration using a calibration block with a circle bearing known positional features. The calibration process is as follows: The X-ray image of the calibration block is binarized, and pixels with gray values greater than a preset threshold are set to white, and those with gray values less than a preset threshold are set to black. Contour detection algorithms are used to detect contours, and the largest circle is determined as the target feature circle based on roundness and area range. The initial affine transformation parameters are calculated using the actual and theoretical coordinates of the characteristic circle.
[0027] To support multi-product production, the system maintains a calibration database that stores the theoretical coordinates of feature points and affine transformation parameters for different products. When switching products, the system can directly load the corresponding parameters, reducing repetitive calibration time and improving production efficiency.
[0028] 2) Machine learning enhances feature extraction To handle X-ray images with high noise or complex internal structures, the system introduces a convolutional neural network (CNN) to enhance feature point extraction: Data preparation: Collect X-ray image datasets and label key feature points (such as weld joints and holes); Model training: Train a CNN model using labeled data to learn the spatial hierarchy in the image; Feature detection: Input the X-ray image into the trained CNN model and output high-precision feature point coordinates.
[0029] 3) Robust transformation estimation In the calculation of affine transformation parameters, the system uses the RANSAC algorithm to handle outliers in feature points: Random sampling: Randomly select at least 3 points from the feature points and calculate the initial transformation parameters; Interior point detection: Substitute all feature points into the model, calculate the residuals, and determine the interior point set; Iterative optimization: Repeated sampling and detection to find the parameters corresponding to the largest set of interior points.
[0030] This method effectively eliminates noise or false detection points, ensuring the reliability of the transformation parameters.
[0031] 4) Adaptive learning and real-time correction The system achieves adaptive learning through a closed-loop feedback mechanism: Marking verification: After laser marking, the actual marking position is verified using a position sensor or by re-imaging; Deviation calculation: Compare the deviation between the actual position and the theoretical position.
[0032] Parameter update: The affine transformation parameters are dynamically updated using recursive least squares or Kalman filtering.
[0033] This mechanism enables the system to adapt to equipment aging, thermal deformation, or product changes, maintaining high precision over a long period.
[0034] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A laser positioning method based on X-ray imaging and affine transformation compensation, characterized in that, Includes the following steps: S1: Obtain an image of the product's internal features and extract the actual coordinates of at least three feature points from the image. ; S2: Establish actual coordinates With theoretical coordinates The affine transformation model between them is given by the following formula: ; S3: Solve for the transformation parameter vector of the affine transformation model using the least squares method. To minimize the sum of squared residuals between theoretical and actual coordinates: ; S4: Set the theoretical target coordinates of the laser device Substitute into the affine transformation model and output the compensated physical coordinates. Then, based on the compensated physical coordinates, the laser head is driven to move to the corrected position.
2. The laser positioning method based on X-ray imaging and affine transformation compensation according to claim 1, characterized in that, In step S1, when extracting image feature points, the calibration block feature circle is first extracted. The specific steps are as follows: The image is binarized, and pixels with gray values greater than a preset gray value threshold are set to white, while those with gray values less than a preset gray value threshold are set to black. Use a contour detection algorithm to perform contour detection on the binarized image; By determining the circularity threshold and area range, the smallest closed circle is drawn, and the largest circle is determined as the target feature circle.
3. The laser positioning method based on X-ray imaging and affine transformation compensation according to claim 2, characterized in that, The specific steps for extracting image feature points include: Image noise is removed using median filtering and bilateral filtering, and image edges are detected using the Sobel operator. Detect contours in an image and filter out contours of interest based on their area; The detected feature points are sorted, and their spacing is analyzed to determine whether the expected arrangement conditions are met. Calculate the average position of the feature points and use it as the center position of the feature points.
4. The laser positioning method based on X-ray imaging and affine transformation compensation according to claim 3, characterized in that, The arrangement condition is 3 rows and 3 columns.
5. A laser positioning system based on X-ray imaging and affine transformation compensation, wherein laser positioning is performed using the method described in any one of claims 1 to 4, characterized in that, include The X-ray imaging module, including an X-ray emitter and a flat panel detector, is used to acquire images of the internal features of a product. A laser head is used to perform laser marking based on coordinates compensated by affine transformation. The control module, connected to the X-ray imaging module and laser head, is used to control the positioning and marking operations of the laser head.
6. The laser positioning system based on X-ray imaging and affine transformation compensation according to claim 5, characterized in that, The control module includes The feature point extraction unit is used to extract feature points from the image. Affine transformation calculation unit, used to establish affine transformation models and solve for transformation parameters; The coordinate compensation unit is used to map the target coordinates to the laser device coordinate system through an affine transformation.
Citation Information
Cited By
Wireless personnel positioning method and system through positioning tag card
CN121348227A
Method and system for nondestructive detection of coconut eyes
CN121595596A