A two-dimensional compensation algorithm based on vision
The module coordinate system is constructed through a visual two-dimensional compensation algorithm. The dual-variable cubic polynomial and proportional-integral control algorithm are used to solve the problem of reduced positioning accuracy caused by guide rail deformation and achieve higher-precision camera positioning.
Patent Information
- Application Number
- CN202511106759.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-08-08
AI Technical Summary
Existing technologies cannot effectively adapt to the deformation of the guide rail caused by temperature and mechanical vibration changes, resulting in a decrease in the positioning accuracy of the motion module after long-term operation.
A vision-based two-dimensional compensation algorithm is adopted. By setting a calibration plate, a two-variable cubic polynomial model is constructed. Combined with the proportional-integral control algorithm, the module coordinate system is dynamically corrected to adapt to temperature and vibration changes.
The compensation accuracy of the module coordinate system is improved, which enables more precise positioning of the camera, eliminates static errors and some dynamic disturbances, and adapts to changes in temperature and mechanical vibration.
Smart Images

Figure CN120599055B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of motion module compensation positioning, and in particular to a vision-based two-dimensional compensation algorithm. Background Art
[0002] When the motion module drives the camera to move, due to assembly and manufacturing issues, the guide rail is not completely straight, so the actual module coordinates are very likely to be curved, which makes it impossible to accurately drive the camera to the set position.
[0003] A common compensation method is to use a laser interferometer to directly measure the position error of the motion module and compensate directly. However, this method is only applicable to static error compensation and cannot adapt to the deformation of the guide rail caused by changes in temperature and mechanical vibration. Therefore, its compensation accuracy will decrease when the motion module works for a long time. Summary of the Invention
[0004] In view of the deficiencies in the prior art, the present invention provides a vision-based two-dimensional compensation algorithm that solves the technical problems in the above-mentioned background technology.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A vision-based two-dimensional compensation algorithm includes the following steps:
[0007] S1. Set up a calibration plate with several calibration points and move the camera to adjust the position of the calibration plate;
[0008] S2. Move the camera through the motion module and record the module coordinates of each calibration point in the reference coordinate system ;
[0009] S3, according to the module coordinates Constructing a bivariate cubic polynomial , to describe the compensation values of all points in the camera working area and build the module coordinate system;
[0010] S4. Move the camera to the set position through the motion module, calculate the deviation between the actual movement and the ideal movement, and calibrate the module coordinate system.
[0011] Furthermore, in step S1, the following steps are specifically included:
[0012] S11. Fix the calibration plate by a precisely positioned mechanical fixture;
[0013] S12, driving the camera to move along the x-axis / y-axis of the reference coordinate system through the motion module;
[0014] S13, aligning a row / column calibration point of the calibration plate with the camera crosshairs.
[0015] Furthermore, in step S2, the following steps are specifically included:
[0016] S21. The motion module drives the camera to move so that the camera crosshairs are aligned with the nearest calibration point and mark it as the coordinate zero point. ;
[0017] S22. The camera continues to move, aligning the camera crosshairs with all calibration points in sequence, and obtaining the initial coordinates of each calibration point in the reference coordinate system. ;
[0018] S23, the initial coordinates Subtract coordinate zero Get the module coordinates of each calibration point .
[0019] Furthermore, in step S3, the following steps are specifically included:
[0020] S31. Calculate the module coordinates of each calibration point The single-point compensation value is calculated as follows:
[0021] ;
[0022] ;
[0023] Where, and Respectively represent the theoretical row and column numbers of the i-th calibration point; The scale factor representing the physical size of the calibration plate and the pixel resolution of the camera; and Respectively represent the single-point compensation value of the i-th calibration point in the x-axis and y-axis directions;
[0024] S32. Construct a bivariate cubic polynomial based on the compensation values of all calibration points ;
[0025] S33, according to the bivariate cubic polynomial Construct a group coordinate system.
[0026] Furthermore, in step S32, the bivariate cubic polynomial The expression is:
[0027] ;
[0028] Where, Indicates module coordinates Single point compensation value at ; represents the polynomial coefficients; and Respectively The order in the x- and y-axis directions.
[0029] Furthermore, in step S4, the following steps are specifically included:
[0030] S411. Select target coordinates And use the motion module to move the camera to the target coordinates ;
[0031] S412, extract the current actual coordinates of the camera ;
[0032] S413. Obtain target coordinates The single point compensation value in the module coordinates is used to calculate the theoretical position deviation. The calculation formula is:
[0033] ;
[0034] ;
[0035] Where, and Represent the target coordinates Theoretical position deviation in the x-axis and y-axis directions; and Represent the target coordinates Compensation values in the x-axis and y-axis directions of the module coordinate system;
[0036] S414: Preset standard residual values in the x-axis and y-axis directions and , and judge or whether it is established;
[0037] If yes, proceed to step S415;
[0038] If not, then end;
[0039] S415. Calculate the dynamic correction value of the module coordinate system using the proportional-integral control algorithm, which is expressed as:
[0040] ;
[0041] ;
[0042] Where, and Respectively represent the dynamic correction amount of the module coordinate system in the x-axis and y-axis directions; and Represent the proportional gain and integral gain respectively;
[0043] S416. Obtain the temperature and vibration amplitude of the motion module and calculate the dynamic weight coefficient ;
[0044] S417, according to the dynamic weight coefficient Calculate the total compensation value, the calculation formula is:
[0045] ;
[0046] ;
[0047] Where, and Respectively represent the total compensation values of the module coordinate system in the x-axis and y-axis directions;
[0048] S418: Correct the module coordinate system according to the total compensation value, and return to step S411.
[0049] Furthermore, in step S416, the dynamic weight coefficient The calculation formula is:
[0050] ;
[0051] Where, Indicates the difference between the current temperature and the calibration temperature; Indicates the calibration temperature; Indicates the vibration amplitude of the motion module; Indicates the maximum allowable vibration amplitude.
[0052] Furthermore, in step S4, the following steps are specifically included:
[0053] S421. Define the x-axis movement trajectory, the y-axis movement trajectory, and the 45-degree diagonal movement trajectory in the module coordinate system;
[0054] S422: Control the motion module to move at a constant speed along the x-axis movement trajectory, the y-axis movement trajectory, and the 45-degree diagonal movement trajectory, and obtain its coordinate positions in the module coordinate system and the standard coordinate system respectively;
[0055] S423. Calculate the trajectory deviation of the coordinate position of each point of each moving trajectory in the module coordinate system and the standard coordinate system. The calculation formula is:
[0056] ;
[0057] ;
[0058] Where, and Represents the trajectory deviation of the jth point of one of the moving trajectories in the module coordinate system and the standard coordinate system on the x-axis and y-axis respectively; and Respectively represent the position of the j-th point of one of the moving trajectories on the x-axis and y-axis of the standard coordinate system; and Respectively represent the position of the j-th point of one of the movement trajectories on the x-axis and y-axis of the module coordinate system;
[0059] S424, inputting the trajectory deviation into a bivariate cubic polynomial , and calibrate the module coordinate system based on it;
[0060] S425, calculating the root mean square error of the trajectory deviation of each moving trajectory ;
[0061] S426, preset standard error value , and determine the root mean square error Is it greater than the standard error value? ;
[0062] If yes, redefine the movement trajectory and return to step S421;
[0063] If not, then end.
[0064] Furthermore, in step S425, the root mean square error The calculation formula is:
[0065] ;
[0066] Where, Indicates the total number of points in each moving trajectory.
[0067] Compared with the existing technology, the present invention provides a vision-based two-dimensional compensation algorithm with the following beneficial effects:
[0068] 1. In the present invention, after the module coordinate system is globally compensated, the local position is compensated. Compared with the common motion module compensation method, it not only eliminates most of the static errors, but also eliminates some dynamic disturbances, and can adapt to changes in temperature and mechanical vibration. Therefore, the compensation accuracy of the module coordinate system is higher, which is conducive to more accurate positioning of the camera in the later stage.
[0069] 2. In the present invention, after constructing the module coordinate system, the actual motion trajectory and the ideal compensation coordinates are compared to compensate for dynamic errors not covered by static calibration, such as vibration and temperature drift. Compared with other compensation methods, the compensation accuracy of the module coordinate system is higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0071] Figure 1 A flowchart of a vision-based two-dimensional compensation algorithm of the present invention;
[0072] Figure 2 Schematic diagram of the standard coordinate system and module coordinate system of the present invention;
[0073] Figure 3 Schematic diagram of the calibration plate of the present invention. DETAILED DESCRIPTION
[0074] To make the above-mentioned objectives, features, and advantages of the present invention more clearly understood, the present invention is further described below in detail with reference to the accompanying drawings and specific embodiments. This will enable a full understanding of how this application uses technical means to solve technical problems and achieve technical effects, and to implement the invention accordingly.
[0075] Those skilled in the art will appreciate that all or part of the steps in the following embodiments can be accomplished by instructing related hardware through a program. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0076] There may be errors in the manufacturing and assembly process of the guide rail. Motor heating or ambient temperature changes may cause the guide rail to expand / contract, causing the guide rail to deform. The motion module moving on the deformed guide rail will make it impossible to drive the camera to a more accurate target position. For this reason, please refer to Figure 1 As shown, the purpose of the first embodiment of the present invention is to propose a vision-based two-dimensional compensation algorithm, comprising the following steps:
[0077] S1. Set up a calibration plate with several calibration points and move the camera to adjust the position of the calibration plate. Specifically, since the calibration plate is an important component for compensating the camera's motion position, it needs to be accurately installed and positioned. To this end, step S1 specifically includes the following steps:
[0078] S11. Fix the calibration plate by a precisely positioned mechanical fixture;
[0079] S12, driving the camera to move along the x-axis / y-axis of the reference coordinate system through the motion module;
[0080] S13, align a row / column of calibration points on the calibration plate with the camera crosshairs; specifically, the calibration points on the calibration plate are evenly arranged, see Figure 3 As shown;
[0081] S2. Move the camera through the motion module and record the module coordinates of each calibration point in the reference coordinate system Specifically, in step S2, the following steps are specifically included:
[0082] S21. The motion module drives the camera to move so that the camera crosshairs are aligned with the nearest calibration point and mark it as the coordinate zero point. ;
[0083] S22. The camera continues to move, aligning the camera crosshairs with all calibration points in sequence, and obtaining the initial coordinates of each calibration point in the reference coordinate system. ;
[0084] S23, the initial coordinates Subtract coordinate zero Get the module coordinates of each calibration point ,in, ; .
[0085] It should be noted that due to the guide rail manufacturing error, assembly error and ambient temperature caused by the guide rail deformation, the coordinate system formed by the motion module will be distorted. Figure 2 As shown, it is necessary to build a reference coordinate system (that is, an accurate coordinate system) based on the image obtained by the camera.
[0086] S3, according to the module coordinates Constructing a bivariate cubic polynomial , to describe the compensation values of all points in the camera working area and construct the module coordinate system; specifically, since the coordinate system formed by the motion module has been distorted, it is significantly different from the reference coordinate system. In order to accurately control the position of the camera, it is necessary to construct its actual coordinate system. To this end, in step S3, the following steps are specifically included:
[0087] S31. Calculate the module coordinates of each calibration point The single-point compensation value is calculated as follows:
[0088] ;
[0089] ;
[0090] Where, and Respectively represent the theoretical row and column numbers of the i-th calibration point; The scale factor representing the physical size of the calibration plate and the pixel resolution of the camera; and Respectively represent the single-point compensation value of the i-th calibration point in the x-axis and y-axis directions; in the present invention, if the i-th calibration point is the calibration of the 3rd row and 5th column in the calibration plate, then and 3 and 5 respectively;
[0091] S32. Construct a bivariate cubic polynomial based on the compensation values of all calibration points , whose expression is:
[0092] ;
[0093] Where, Indicates module coordinates Single point compensation value at ; represents the polynomial coefficients; and Respectively The order in the x-axis and y-axis directions; in the present invention, and The value range of is an integer from 0 to 3; Obtained by substituting the module coordinates of all calibration points and using the least squares method;
[0094] S34. According to the bivariate cubic polynomial Construct a group coordinate system.
[0095] S4. The camera is moved to a set position using the motion module, the deviation between the actual movement and the ideal movement is calculated, and the module coordinate system is corrected. Specifically, since the motion module is likely to deform due to thermal deformation and vibration during operation, and the above calculation method cannot adapt to such instantaneous deformation, the compensation result still contains errors, which is not conducive to accurate positioning of the camera based on it. Therefore, in step S4, the following steps are specifically included:
[0096] S411. Select target coordinates And use the motion module to move the camera to the target coordinates ;
[0097] S412, extract the current actual coordinates of the camera ; specific, actual coordinates The coordinate position of the camera in the standard coordinate system after movement;
[0098] S413. Obtain target coordinates The single point compensation value in the module coordinates is used to calculate the theoretical position deviation. The calculation formula is:
[0099] ;
[0100] ;
[0101] Where, and Represent the target coordinates Theoretical position deviation in the x-axis and y-axis directions; and Represent the target coordinates Compensation values in the x-axis and y-axis directions of the module coordinate system;
[0102] S414: Preset standard residual values in the x-axis and y-axis directions and , and judge or whether it is established;
[0103] If yes, proceed to step S415;
[0104] If not, then end;
[0105] S415. Calculate the dynamic correction value of the module coordinate system using the proportional-integral control algorithm, which is expressed as:
[0106] ;
[0107] ;
[0108] Where, and Respectively represent the dynamic correction amount of the module coordinate system in the x-axis and y-axis directions; and Respectively represent proportional gain and integral gain; In the present invention, and 0.15 and 0.08 respectively;
[0109] S416. Obtain the temperature and vibration amplitude of the motion module and calculate the dynamic weight coefficient , and its calculation formula is:
[0110] ;
[0111] Where, Indicates the difference between the current temperature and the calibration temperature; Indicates the calibration temperature; Indicates the vibration amplitude of the motion module; Indicates the maximum allowable vibration amplitude; in the present invention, and Can be obtained through design parameters;
[0112] S417, according to the dynamic weight coefficient Calculate the total compensation value, the calculation formula is:
[0113] ;
[0114] ;
[0115] Where, and Respectively represent the total compensation values of the module coordinate system in the x-axis and y-axis directions;
[0116] S418: Correct the module coordinate system according to the total compensation value, and return to step S411.
[0117] In the present invention, after globally compensating the module coordinate system, the local position is compensated. Compared with the common motion module compensation method, it not only eliminates most of the static errors, but also eliminates some dynamic disturbances, and can adapt to changes in temperature and mechanical vibration. Therefore, the compensation accuracy of the module coordinate system is higher, which is conducive to more accurate positioning of the camera in the later stage.
[0118] The second embodiment of the present invention provides another method for calibrating the module coordinate system. Therefore, in step S4, the method specifically includes the following steps:
[0119] S421, define the x-axis movement trajectory, y-axis movement trajectory and 45-degree diagonal movement trajectory in the module coordinate system; specifically, the x-axis movement trajectory is to select a value on the y-axis and make the motion module move along the x-axis from the value arrive Similarly, the y-axis movement trajectory is to select a value on the x-axis and make the motion module move along the y-axis from arrive Move; The moving trajectory of the 45-degree diagonal moving trajectory is x=y, that is, from arrive move;
[0120] S422: Control the motion module to move at a constant speed along the x-axis movement trajectory, the y-axis movement trajectory, and the 45-degree diagonal movement trajectory, and obtain its coordinate positions in the module coordinate system and the standard coordinate system respectively;
[0121] S423. Calculate the trajectory deviation of the coordinate position of each point of each moving trajectory in the module coordinate system and the standard coordinate system. The calculation formula is:
[0122] ;
[0123] ;
[0124] Where, and Represents the trajectory deviation of the jth point of one of the moving trajectories in the module coordinate system and the standard coordinate system on the x-axis and y-axis respectively; and Respectively represent the position of the j-th point of one of the moving trajectories on the x-axis and y-axis of the standard coordinate system; and Respectively represent the position of the j-th point of one of the movement trajectories on the x-axis and y-axis of the module coordinate system;
[0125] S424, inputting the trajectory deviation into a bivariate cubic polynomial , and calibrate the module coordinate system based on it;
[0126] S425, calculating the root mean square error of the trajectory deviation of each moving trajectory , and its calculation formula is:
[0127] ;
[0128] Where, Indicates the total number of points in each moving trajectory;
[0129] S426, preset standard error value , and determine the root mean square error Is it greater than the standard error value? ;
[0130] If yes, redefine the movement trajectory and return to step S421; specifically, reselect a different movement trajectory according to the method of selecting the movement trajectory in step S421;
[0131] If not, then end.
[0132] In a second embodiment of the present invention, after constructing the module coordinate system, the actual motion trajectory and the ideal compensation coordinates are compared to compensate for dynamic errors not covered by static calibration, such as vibration and temperature drift. Compared with other compensation methods, the compensation accuracy of the module coordinate system is higher.
[0133] The above embodiments provide a detailed introduction to the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present invention.
Claims
1. A vision-based two-dimensional compensation algorithm, characterized in that: The following steps are involved: S1. Set up a calibration plate with several calibration points and move the camera to adjust the position of the calibration plate; S2. Move the camera through the motion module and record the module coordinates of each calibration point in the reference coordinate system ; S3, according to the module coordinates Constructing a bivariate cubic polynomial , to describe the compensation values of all points in the camera working area and build the module coordinate system; S4. Move the camera to the set position through the motion module, calculate the deviation between the actual movement and the ideal movement, and calibrate the module coordinate system; In step S4, the following steps are specifically included: S411. Select target coordinates And use the motion module to move the camera to the target coordinates ; S412, extract the current actual coordinates of the camera ; S413. Obtain target coordinates The single point compensation value in the module coordinates is used to calculate the theoretical position deviation. The calculation formula is: ; ; Where, and Represent the target coordinates Theoretical position deviation in the x-axis and y-axis directions; and Represent the target coordinates Compensation values in the x-axis and y-axis directions of the module coordinate system; S414: Preset standard residual values in the x-axis and y-axis directions and , and judge or whether it is established; If yes, proceed to step S415; If not, then end; S415. Calculate the dynamic correction value of the module coordinate system using the proportional-integral control algorithm, which is expressed as: ; ; Where, and Respectively represent the dynamic correction amount of the module coordinate system in the x-axis and y-axis directions; and Represent the proportional gain and integral gain respectively; S416. Obtain the temperature and vibration amplitude of the motion module and calculate the dynamic weight coefficient ; In step S416, the dynamic weight coefficient The calculation formula is: ; Where, Indicates the difference between the current temperature and the calibration temperature; Indicates the calibration temperature; Indicates the vibration amplitude of the motion module; Indicates the maximum allowable vibration amplitude; S417, according to the dynamic weight coefficient Calculate the total compensation value, the calculation formula is: ; ; Where, and Respectively represent the total compensation values of the module coordinate system in the x-axis and y-axis directions; S418: Correct the module coordinate system according to the total compensation value, and return to step S411.
2. The two-dimensional compensation algorithm according to claim 1, characterized in that: In step S1, the following steps are specifically included: S11. Fix the calibration plate by a precisely positioned mechanical fixture; S12, driving the camera to move along the x-axis / y-axis of the reference coordinate system through the motion module; S13, aligning a row / column calibration point of the calibration plate with the camera crosshairs.
3. The two-dimensional compensation algorithm according to claim 1, characterized in that: In step S2, the following steps are specifically included: S21. The motion module drives the camera to move so that the camera crosshairs are aligned with the nearest calibration point and mark it as the coordinate zero point. ; S22. The camera continues to move, aligning the camera crosshairs with all calibration points in sequence, and obtaining the initial coordinates of each calibration point in the reference coordinate system. ; S23, the initial coordinates Subtract coordinate zero Get the module coordinates of each calibration point .
4. The two-dimensional compensation algorithm according to claim 1, characterized in that: In step S3, the following steps are specifically included: S31. Calculate the module coordinates of each calibration point The single-point compensation value is calculated as follows: ; ; Where, and Respectively represent the theoretical row and column numbers of the i-th calibration point; The scale factor representing the physical size of the calibration plate and the pixel resolution of the camera; and Respectively represent the single-point compensation value of the i-th calibration point in the x-axis and y-axis directions; S32. Construct a bivariate cubic polynomial based on the compensation values of all calibration points ; S33, according to the bivariate cubic polynomial Construct a group coordinate system.
5. The two-dimensional compensation algorithm according to claim 4, characterized in that: In step S32, the bivariate cubic polynomial The expression is: ; Where, Indicates module coordinates Single point compensation value at ; represents the polynomial coefficients; and Respectively The order in the x- and y-axis directions.
Citation Information
Patent Citations
LDI platform error compensation method
CN111983900A
Camera internal reference calibration method and device, equipment and storage medium
CN120279106A