A method for automatic calibration of CNC turntable
Through the checkerboard calibration plate and binocular camera calibration method, the rotation axis position of the CNC turntable is automatically calculated, which solves the problems of low calibration efficiency and insufficient accuracy in the existing technology, and realizes efficient and accurate CNC turntable calibration, improving processing quality.
Patent Information
- Application Number
- CN202411983146.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-12-31
AI Technical Summary
The existing CNC turntable calibration methods are inefficient, insufficiently accurate and complex in operation, making it difficult to meet the needs of industrial automation and intelligent manufacturing.
The checkerboard calibration plate and a binocular camera are used to collect the image set by controlling the rotation of the CNC rotary table, calibrate the camera's internal and external parameters, calculate the spatial points, fit the center of the circle and determine the spatial position of the rotation axis, obtain the rotation translation transformation matrix, reduce manual intervention, and improve calibration efficiency and accuracy.
It realizes efficient and accurate CNC turntable calibration, reduces manual intervention, shortens processing preparation time, and improves processing accuracy and efficiency.
Smart Images

Figure CN119396080B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical fields of machine vision, mechanical processing and automatic control, and in particular relates to an automatic calibration method for a numerical control turntable. Background Art
[0002] In the field of CNC machining, accurate calibration of CNC turntables is a key step to ensure machining accuracy. Traditional manual calibration methods have problems such as low efficiency, insufficient accuracy and complex operation. With the development of industrial automation and intelligent manufacturing, it is particularly important to improve the efficiency and accuracy of CNC turntable calibration. In recent years, the application of 3D scanning technology in CNC machining has become increasingly common. Through 3D scanning, the 3D data of the workpiece can be quickly obtained, the machining automation can be realized, and the time and labor costs can be significantly reduced.
[0003] However, existing 3D scanning and calibration methods still have some limitations. For example, most existing calibration methods rely on manual operation, which easily introduces errors and affects the final processing quality. Therefore, it is urgent to develop an efficient, accurate and automated CNC turntable calibration method. Summary of the invention
[0004] The purpose of the present invention is to propose an automatic calibration method for a CNC turntable, which can improve the efficiency and accuracy of calibration, reduce manual intervention, and is suitable for a variety of precision machining and automation control scenarios.
[0005] The present invention is achieved through the following technical solutions:
[0006] A method for automatic calibration of a numerical control turntable comprises the following steps:
[0007] Step S1, a calibration plate with a checkerboard is fixed on a CNC turntable, and the turntable is controlled to rotate at the same angle and direction for multiple times. After each rotation, a calibration plate image is captured by a camera until the checkerboard is outside the camera shooting range, thereby obtaining an image set;
[0008] Step S2, calibrating the intrinsic parameters of the camera according to the calibration plate, calculating the corner point positions of the checkerboard in each calibration plate image in the image set, and calculating the extrinsic parameters of the camera according to the corner point positions;
[0009] Step S3, using the intrinsic and extrinsic parameters of the camera determined in step S2, converting each corner point in each calibration plate image into a space point in the world coordinate system, using the space point, obtaining the initial value of the circle center fitting by calculating the perpendicular bisector, and performing circle center fitting to obtain multiple circle center points;
[0010] Step S4: using the multiple center points obtained in step S3, determine the spatial position of the rotation axis through straight line fitting, and obtain a transformation matrix for realizing rotation and translation according to the spatial position of the rotation axis and a given rotation angle.
[0011] Furthermore, in step S1, a host computer is used to control the rotation of the CNC turntable, and the angle of each rotation is 5-10 degrees, and the direction of each rotation is the same.
[0012] Furthermore, in step S3, the image set includes N There are calibration plate images, each of which has M Corner points N The calibration plate image M The corner points are converted into space points in the world coordinate system respectively. N space points as a group of space points.
[0013] Furthermore, obtaining the initial value of the circle center fitting in step S3 specifically includes the following steps:
[0014] Step S31, in the m In the group of spatial points, randomly select three different spatial points , , , 1≤ m ≤ M , 1≤ i ≤ N , 1≤ j ≤ N , 1≤ k ≤ N ;
[0015] Step S32: Get line segments respectively The perpendicular bisector and line segment The perpendicular bisector and line segment The perpendicular bisector of any two perpendicular bisectors is , , The intersection of the planes formed is the center of the circle. , , Any point in , , Solve the direction vector parameters in the intersection line parameter equation of the plane formed, and get the first m Initial value of the center of the fitted circle corresponding to the group space point ;
[0016] Step S33, repeating steps S31 to S32 to obtain the initial values of the centers of the fitting circles corresponding to the groups of spatial points.
[0017] Furthermore, performing circle center fitting in step S3 to obtain multiple circle center points specifically includes the following steps:
[0018] Step S34: m Group Space Point , determine the objective function with the goal of minimizing the center of the circle , where 1≤ i' ≤ N , 1≤ j' ≤ N , Indicates the use of m The center of the circle to which the group space points fit;
[0019] Step S35: According to the formula calculate About the center The gradient of Represents finding a point in space To the center The square of the Euclidean distance;
[0020] Step S36: As the initial value, according to the formula Iterate and update until the objective function converges to obtain the m The center of the circle to which the group space point fits ,in, Indicates k' The value of the center of the circle in iteration , is the learning rate;
[0021] Step S37, repeat steps S35 to S36 to obtain M The centers of the circles fitted by the group of spatial points.
[0022] Furthermore, determining the spatial position of the rotation axis in step S4 specifically includes the following steps:
[0023] Step S41: Setting the rotation axis , the sum of the squares of the distances from the center of the circle fitted by each group of spatial points to the rotation axis is minimal;
[0024] Step S42: According to the formula calculate M The group space points are fitted M The centroid of the circle , No. m The center of the circle fitted by the group space point is expressed as ;
[0025] Step S43: M The center of the circle and the corresponding center of mass of the group space point fitting are used to construct the covariance matrix: , and construct the eigenvalue problem as , by calculating the characteristic polynomial of the covariance matrix S Calculate the eigenvalues and obtain the corresponding eigenvectors. Select the eigenvector corresponding to the largest eigenvalue as the direction vector k of the straight line, and make , I is the identity matrix, the parameter t is the independent variable of the linear expression as the rotation axis, Represents the calculation matrix The determinant of represents the eigenvalue to be solved, express The corresponding feature vector.
[0026] Furthermore, the step S4 of obtaining the transformation matrix for realizing rotation and translation specifically includes the following steps:
[0027] Step S44: According to the formula Calculate the rotation matrix R, where is the direction vector k=( k x , k y , k z ), is the given rotation angle;
[0028] Step S45: According to the formula Calculate the transformation matrix T, where is the translation vector, is the rotation center point, Represents the zero vector.
[0029] Furthermore, the camera is a binocular camera, and the image set consists of images captured by a left camera or a right camera of the binocular camera.
[0030] Furthermore, in step S2, the intrinsic parameters of the camera are calibrated according to the size of the checkerboard on the calibration board and the Zhang Zhengyou calibration method, and the intrinsic parameters of the camera include focal length and principal point offset data.
[0031] The present invention has the following beneficial effects:
[0032] 1. The present invention first controls a calibration plate provided with a chessboard to rotate at the same angle and direction to obtain an image set, and calibrates the intrinsic parameters of the camera and calculates the extrinsic parameters of the camera. Then, according to the intrinsic parameters and extrinsic parameters of the camera, each corner point in each calibration plate image in the image set is converted into a spatial point in the world coordinate system. The initial value of the circle center fitting is obtained by calculating the perpendicular bisector, and the circle center fitting is performed to obtain a plurality of circle center points. Finally, the spatial position of the rotation axis is determined by linear fitting using the plurality of circle center points obtained by fitting, and the transformation matrix for realizing rotation and translation is obtained according to the spatial position of the rotation axis and the given rotation angle. In this way, manual intervention is reduced during the calibration process, the efficiency and accuracy of the calibration are improved, and the calibration process is quickly completed by real-time acquisition and processing of image data, thereby shortening the processing preparation time. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The present invention is further described in detail below with reference to the accompanying drawings.
[0034] Figure 1 It is a flow chart of the present invention.
[0035] Figure 2 is the corner point position of the chessboard in the calibration plate image of the present invention.
[0036] Figure 3 It is a schematic diagram of the group space points of the present invention.
[0037] Figure 4 It is a schematic diagram of the center of the circle and the axis of the fitting of the present invention. DETAILED DESCRIPTION
[0038] like Figure 1 As shown, the automatic calibration method of the CNC turntable includes the following steps:
[0039] Step S1, a calibration plate with a checkerboard is fixed on a CNC turntable, and the turntable is controlled to rotate at the same angle and direction for multiple times. After each rotation, a calibration plate image is captured by a camera until the checkerboard is outside the camera shooting range, thereby obtaining an image set;
[0040] Specifically, the host computer is connected to the CNC system through the communication interface Ethernet to control the fifth axis (i.e., CNC turntable) of the CNC machine tool to rotate. A standard chessboard calibration plate with known geometric dimensions and feature points is fixed on the turntable of the fifth axis.
[0041] The host computer controls the rotation of the CNC turntable. Each rotation angle is 5-10 degrees, and each rotation direction is the same. Each time it rotates, the camera collects and saves the calibration plate image. The camera used to collect images can be a binocular camera or a monocular camera. In the case of a binocular camera, the image set consists of the calibration plate image collected by the left or right camera of the binocular camera. By controlling the rotation by the host computer, it can ensure that the angle of each rotation is accurate and consistent.
[0042] Step S2, calibrating the intrinsic parameters of the camera according to the calibration plate, calculating the corner point positions of the checkerboard in each calibration plate image in the image set, and calculating the extrinsic parameters of the camera according to the corner point positions;
[0043] Specifically, the camera's internal parameters are calibrated according to the size of the checkerboard on the calibration board and the Zhang Zhengyou calibration method (other existing standard calibration methods can also be used). The camera's internal parameters include focal length and principal point offset data. The corner positions of the checkerboard in each calibration board image are calculated by collecting multiple calibration board images, such as Figure 2 As shown, the camera's external parameters are calculated using these corner point positions, including a rotation matrix and a translation vector. The process of calculating the corner point positions and external parameters is a prior art.
[0044] Step S3, using the intrinsic and extrinsic parameters of the camera determined in step S2, converting each corner point in each calibration plate image into a space point in the world coordinate system, using the space point, obtaining the initial value of the circle center fitting by calculating the perpendicular bisector, and performing circle center fitting to obtain multiple circle center points;
[0045] For the grouping of spatial points, the specific process is as follows: the image set contains N There are calibration plate images, each of which has M =56 corner points, N The calibration plate image M The corner points are converted into space points in the world coordinate system respectively. N space points as a group of space points, there are M Group space points. Figure 3 The first group of spatial points, the second group of spatial points and the third group of spatial points are marked as shown (only three calibration plate images are taken as an example).
[0046] The steps of obtaining the initial value of the circle center fitting are as follows:
[0047] Step S31, in the m In the group of spatial points, randomly select three different spatial points , , , 1≤ m ≤ M , 1≤ i ≤N , 1≤ j ≤ N , 1≤ k ≤ N ;
[0048] Step S32: Get line segments respectively The perpendicular bisector and line segment The perpendicular bisector and line segment The perpendicular bisector of any two perpendicular bisectors is , , The intersection of the planes formed is the center of the circle. , , Any point in , , Solve the direction vector parameters in the intersection line parameter equation of the plane formed, and get the first m Initial value of the center of the fitted circle corresponding to the group space point ;
[0049] The calculation of the perpendicular bisector includes the following steps:
[0050] (1) Calculate vector ,vector ,vector ;
[0051] (2) According to the formula Calculated by , , The normal vector n of the formed plane;
[0052] (3) Calculate line segments separately , , midpoint M 1=( M 1x , M 1y , M 1z )、 M 2=( M 2x , M 2y , M 2z )and M 3=( M 3x , M 3y , M3z );
[0053] (4) Line segment , and The plane normal vectors of the perpendicular bisector of , and , then the line segment The equation of the perpendicular bisector of is expressed as , n 1x , n 1y , n 1z Respectively The component of the line segment The equation of the perpendicular bisector of is expressed as , n 2x , n 2y , n 2z Respectively The component of the line segment The equation of the perpendicular bisector of is expressed as , n 3x , n 3y , n 3z Respectively The amount.
[0054] Select line segment , The perpendicular bisectors of the two planes intersect to form an intersection line. Then any point on this intersection line is and The distance to and The distances are also equal, which means that the points on this intersection line are all , , The direction vector of the intersection line on the defined circle .
[0055] Since this intersection is , , The intersection of the intersection line and the plane is the center of the circle. To find the intersection point, the intersection line is expressed in parameter form as , substitute the equation expressed in parameter form into the equation given by , , Defined plane equation Solve t to obtain the initial value of the center of the fitting circle ,in, ,for d x , d y , d z for The amount.
[0056] Step S33, repeating step S31 to step S32 to obtain the initial value of each fitting circle center corresponding to each group of spatial points;
[0057] Performing circle center fitting to obtain multiple circle center points specifically includes the following steps:
[0058] Step S34: m Group Space Point , determine the objective function with the goal of minimizing the center of the circle , where 1≤ i' ≤ N , 1≤ j' ≤ N , Indicates the use of m The center of the circle to which the group space points fit;
[0059] Step S35: According to the formula calculate About the center The gradient of Represents finding a point in space To the center The square of the Euclidean distance;
[0060] Step S36: As the initial value, according to the formula Iterate and update until the objective function converges or reaches the maximum number of iterations, and get the m The center of the circle to which the group space point fits ,in, Indicates k' The value of the center of the circle in iteration , is the learning rate, k' is an integer.
[0061] Step S37, repeat steps S35 to S36 to obtain M The centers of the circles fitted by the group of spatial points.
[0062] Step S4, using the multiple center points obtained in step S3, determine the spatial position of the rotation axis through straight line fitting, and obtain a transformation matrix for realizing rotation and translation according to the spatial position of the rotation axis and a given rotation angle;
[0063] The fitted M The centers of the circles are concentrated near the rotation axis, so the rotation axis can be fitted using these centers, which includes the following steps:
[0064] Step S41: Setting the rotation axis , the sum of the squares of the distances from the center of the circle fitted by each group of spatial points to the rotation axis is minimized, even if the objective function of E Minimum;
[0065] Step S42: According to the formula calculate M The group space points are fitted M The centroid of the circle , among which m The center of the circle fitted by the group space point is expressed as ;
[0066] Step S43: M The center of the circle and the corresponding center of mass of the group space point fitting are used to construct the covariance matrix: , and construct the eigenvalue problem as , S is a 3x3 matrix, by calculating the characteristic polynomial of the covariance matrix S Three eigenvalues are calculated , for each eigenvalue , solve the equation Get the corresponding feature vector , select the eigenvector corresponding to the largest eigenvalue as the direction vector k of the straight line, and make , I is the unit matrix, thus determining the rotation axis , where the parameter t is the independent variable of the linear expression as the axis of rotation, Represents the calculation matrix The determinant of represents the eigenvalue to be solved, express The corresponding feature vector is Figure 4 In the figure, the purple, orange, and pink squares represent the positions of all corner points identified when the calibration plate is rotated to different positions. The multiple gray rings represent the multiple circle centers fitted according to multiple sets of spatial points. The green straight line represents the rotation axis obtained by fitting all the circle centers.
[0067] Step S44: According to the formula Calculate the rotation matrix R, where is the direction vector k=( k x , k y , k z ), , is the given rotation angle;
[0068] Step S45: According to the formula Calculate the transformation matrix T, where is the translation vector, is the rotation center point, the translation vector t is used to move the rotation center point to the origin, rotate it and then move it back to the original position, R is The rotation matrix of The translation vector of for The zero vector of scalar.
[0069] The above description is only a preferred embodiment of the present invention, and therefore cannot be used to limit the scope of implementation of the present invention. That is, equivalent changes and modifications made according to the scope of the patent application of the present invention and the contents of the specification should still fall within the scope covered by the patent of the present invention.
Claims
1. A method for automatic calibration of a CNC turntable, characterized in that: The steps include: Step S1, a calibration plate with a checkerboard is fixed on a CNC turntable, and the turntable is controlled to rotate at the same angle and direction for multiple times. After each rotation, a calibration plate image is captured by a camera until the checkerboard is outside the camera shooting range, thereby obtaining an image set; Step S2, calibrating the intrinsic parameters of the camera according to the calibration plate, calculating the corner point positions of the checkerboard in each calibration plate image in the image set, and calculating the extrinsic parameters of the camera according to the corner point positions; Step S3, using the intrinsic and extrinsic parameters of the camera determined in step S2, converting each corner point in each calibration plate image into a space point in the world coordinate system, using the space point, obtaining the initial value of the circle center fitting by calculating the perpendicular bisector, and performing circle center fitting to obtain multiple circle center points; Step S4, using the multiple center points obtained in step S3, determine the spatial position of the rotation axis through straight line fitting, and obtain a transformation matrix for realizing rotation and translation according to the spatial position of the rotation axis and a given rotation angle; In step S3, the image set includes N There are calibration plate images, each of which has M Corner points N The calibration plate image M The corner points are converted into space points in the world coordinate system respectively. N Space points as a group of space points; The step S3 of obtaining the initial value of the circle center fitting specifically includes the following steps: Step S31, in the m In the group of spatial points, randomly select three different spatial points , , , 1≤ m ≤ M , 1≤ i ≤ N , 1≤ j ≤ N , 1≤ k ≤ N ; Step S32: Get line segments respectively The perpendicular bisector and line segment The perpendicular bisector and line segment The perpendicular bisector of any two perpendicular bisectors is , , The intersection of the planes formed is the center of the circle. , , Any point in , , Solve the direction vector parameters in the intersection line parameter equation of the plane formed, and get the first m Initial value of the center of the fitted circle corresponding to the group space point ; Step S33, repeating steps S31 to S32 to obtain the initial values of the centers of the fitting circles corresponding to the groups of spatial points.
2. The method for automatic calibration of a CNC turntable according to claim 1, characterized in that: In the step S1, a host computer is used to control the rotation of the CNC turntable, and the angle of each rotation is 5-10 degrees, and the direction of each rotation is the same.
3. The method for automatic calibration of a CNC turntable according to claim 1, characterized in that: The step S3 of performing circle center fitting to obtain multiple circle center points specifically includes the following steps: Step S34: m Group Space Point , determine the objective function with the goal of minimizing the center of the circle , where 1≤ i' ≤ N , 1≤ j' ≤ N , Indicates the use of m The center of the circle to which the group space points fit; Step S35: According to the formula calculate About the center The gradient of Represents finding a point in space To the center The square of the Euclidean distance; Step S36: As the initial value, according to the formula Perform iterative updates until the objective function converges and obtain the m The center of the circle to which the group space point fits ,in, Indicates k' The value of the center of the circle in iteration , is the learning rate; Step S37, repeat steps S35 to S36 to obtain M The centers of the circles fitted by the group of spatial points.
4. The method for automatic calibration of a CNC turntable according to claim 3, characterized in that: Determining the spatial position of the rotation axis in step S4 specifically includes the following steps: Step S41: Setting the rotation axis , the sum of the squares of the distances from the center of the circle fitted by each group of spatial points to the rotation axis is minimal; Step S42: According to the formula calculate M The group space points are fitted M The centroid of the circle , No. m The center of the circle fitted by the group space point is expressed as ; Step S43: M The center of the circle and the corresponding center of mass of the group space point fitting are used to construct the covariance matrix: , and construct the eigenvalue problem as , by calculating the characteristic polynomial of the covariance matrix S Calculate the eigenvalues and obtain the corresponding eigenvectors. Select the eigenvector corresponding to the largest eigenvalue as the direction vector k of the straight line, and make , I is the identity matrix, the parameter t is the independent variable of the linear expression as the rotation axis, Represents the calculation matrix The determinant of represents the eigenvalue to be solved, express The corresponding feature vector.
5. The method for automatic calibration of a CNC turntable according to claim 4, characterized in that: The step S4 of obtaining the transformation matrix for realizing rotation and translation specifically includes the following steps: Step S44: According to the formula Calculate the rotation matrix R, where is the direction vector k=( k x , k y , k z ), is the given rotation angle; Step S45: According to the formula Calculate the transformation matrix T, where is the translation vector, is the rotation center point, Represents the zero vector.
6. A method for automatic calibration of a CNC turntable according to any one of claims 1 to 5, characterized in that: The camera is a binocular camera, and the image set is composed of images captured by a left camera or a right camera of the binocular camera.
7. A method for automatic calibration of a CNC turntable according to any one of claims 1 to 5, characterized in that: In the step S2, the intrinsic parameters of the camera are calibrated according to the size of the checkerboard on the calibration board and the Zhang Zhengyou calibration method, and the intrinsic parameters of the camera include focal length and principal point offset data.
Citation Information
Patent Citations
Three-dimensional point cloud splicing method, device and system
CN109064400A