Calibration parameter determination method, correction method, medium and equipment
By acquiring the point cloud data of the workpiece and constructing an objective function to determine the optimal transformation matrix, the problem of low calibration accuracy and low efficiency in the measurement of large robot workpieces is solved, achieving efficient correction accuracy and wide application.
Patent Information
- Application Number
- CN202410971596.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-07-19
AI Technical Summary
In the existing technology, the calibration accuracy and efficiency of large-scale robot workpiece size measurement are low, and the application scenarios are limited. The spatial position and shape and size information of feature points cannot be effectively optimized, resulting in inaccurate measurement.
By obtaining the point cloud data of the workpiece, the spatial information and size information of the characteristic measuring points are extracted, and an objective function is constructed to determine the optimal transformation matrix, so that the error during spatial information conversion is minimized, and then the correction parameters are obtained to improve the correction accuracy.
It realizes the calibration process without additional auxiliary measuring equipment, simplifies the process, improves calibration efficiency, reduces costs, expands the scope of application, and improves calibration accuracy.
Smart Images

Figure CN118518009B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a calibration parameter determination method, a correction method, a medium and a device. Background Art
[0002] The current technical means for robot-based large workpiece size measurement requires the robot end to drive the acquisition module to move to multiple measurement points for surface shape measurement, and read the corresponding measurement posture of the robot at different feature points, and then stitch all the measurement point clouds to reflect the overall size and shape of the measured workpiece, or use additional external tracking equipment to monitor the movement state of the measurement robot in real time to obtain the posture information of the measurement device at the end of the robot to stitch all the measurement point clouds for measurement, or measure the workpiece surface while measuring additional reference objects to reflect the positioning information of the measurement device at the end of the robot to stitch all the measurement point clouds for measurement.
[0003] Therefore, in the prior art, the absolute positioning accuracy and hand-eye calibration error problems brought by the robot itself will greatly affect the accuracy of the measurement splicing data of multiple feature points, resulting in inaccurate measurements; the parametric correction of the robot itself is still limited by the multi-coupling factors of the robot's motion errors and the nonlinear characteristics of the errors in different measurement postures, and the accuracy cannot be further improved, and the calibration needs to be performed offline; and the method of using a third-party visual tracking instrument to track the movement trajectory and posture of a special positioning object installed at the end of the robot to locate the motion parameters of the end acquisition module in real time requires additional hardware equipment to assist, and the setting is complex and costly; and the method of reflecting the positioning information of the robot's end measurement device by simultaneously measuring a reference object requires special settings on or around the workpiece surface, which has additional hardware costs and limits the scope of application for the process and the workpiece itself; in addition, the above methods can only optimize the spatial point information of the feature points, but cannot perform correction and optimization on the shape and size information of a single feature point itself.
[0004] Therefore, how to improve the existing technology's limited application scenarios, unchanged operation, low calibration accuracy, and low calibration efficiency is a technical problem that needs to be urgently solved in this field. Summary of the invention
[0005] Based on this, the purpose of the present application is to provide a calibration parameter determination method, a correction method, a medium and a device to solve at least one of the technical problems mentioned in the above background technology.
[0006] In a first aspect, the present application provides a calibration parameter determination method, comprising:
[0007] S1: Obtain the point cloud data of the calibration workpiece;
[0008] S2: Extract the feature point spatial information and feature size information of each feature according to the point cloud data, and number them accordingly;
[0009] S3: According to the spatial information of each characteristic measuring point and the number mapping corresponding to the prior measuring point spatial information, an objective function is constructed to determine the optimal transformation matrix so that the error between the two is minimized when the spatial information is converted;
[0010] S4: transforming the spatial information, the characteristic size information, the priori spatial information, and the priori size information of each characteristic measurement point into the same coordinate system according to the optimal transformation matrix;
[0011] S5: Obtain the difference between the spatial information and the characteristic size information of the feature measuring points with the same number in the same coordinate system and the priori spatial information and the priori size information of the measuring points as the correction parameters.
[0012] Furthermore, the step of obtaining the point cloud data of the calibration workpiece includes:
[0013] Control the robot to move to several predetermined positions along a priori fixed trajectories to collect and calibrate the surface point cloud of the workpiece, obtain partial point clouds of the surface of the calibrated workpiece in several acquisition device coordinate systems, and obtain the current posture of the robot when it is at each predetermined position;
[0014] According to the current posture of the robot when it is located at each predetermined position and the prior transformation matrix between the acquisition device and the robot end, the point cloud of the calibration workpiece surface is converted to the robot base coordinate system, and the point cloud data of the calibration workpiece is obtained by splicing;
[0015] The point cloud data of the calibration workpiece is filtered and / or down-sampled to obtain optimized point cloud data of the calibration workpiece.
[0016] Further, according to the point cloud data, the feature point spatial information and feature size information of each feature are extracted and numbered accordingly, including:
[0017] S21: extracting a number of initial feature area point clouds corresponding to the point cloud data according to the a priori region of interest;
[0018] S22: Fitting a plane to each initial feature region point cloud to obtain a corresponding plane equation and a plane normal vector;
[0019] S23: Projecting each initial feature region point cloud along the plane normal vector to the corresponding plane equation to obtain a projected point cloud;
[0020] S24: randomly selecting a number of points from the projected point cloud and the initial feature area point cloud to construct a matrix calculation formula, obtain a plane equation and a point cloud conversion matrix of the initial feature area point cloud, so as to convert the initial feature area point cloud to the plane equation and obtain a two-dimensional point cloud image;
[0021] S25: Obtain the binary image of the two-dimensional point cloud image, perform contour extraction on it, and obtain the internal contour of the binary image of the two-dimensional point cloud image;
[0022] S26: Perform contour fitting on the internal contour to obtain the feature points and feature dimensions of the fitted figure, and project them onto the plane equation to obtain the spatial information of the feature measurement points and the feature dimension information.
[0023] Furthermore, according to the point cloud data, extracting the spatial information of the feature measurement points and the feature dimension information of each feature, and corresponding to the numbered steps, further includes:
[0024] S27: Repeat steps S1 - S26 until the set number of spatial information of the feature measurement points and the feature dimension information are obtained;
[0025] S28: Calculate the average value of the several spatial information of the feature measurement points and the feature dimension information corresponding to each feature, and obtain the difference between the spatial information of each feature measurement point and the feature dimension information and the average value;
[0026] S29: Determine whether the difference is less than the difference threshold. If it is less, retain the spatial information of the feature measurement points and the feature dimension information. If it is not less,剔除 the corresponding spatial information of the feature measurement points and the feature dimension information;
[0027] S210: Obtain the average value of the several spatial information of the feature measurement points and the feature dimension information corresponding to each feature in the remaining data, which is the finally determined spatial information of the feature measurement points and the feature dimension information.
[0028] Furthermore, the steps of obtaining the optimal transformation matrix according to the spatial information of each feature measurement point and the numbered mapping corresponding prior measurement point spatial information include:
[0029] Sort the spatial information of each measurement point according to the spatial information of the measurement point or / and the feature dimension information, and assign weights to the spatial information of each measurement point and the corresponding prior measurement point spatial information according to the sorting result;
[0030] Construct the objective function 3 - 1 according to the spatial information of each feature measurement point, the corresponding prior measurement point spatial information, and the weights of the two to determine the optimal transformation matrix 3 - 2:
[0031] 3 - 1
[0032] 3 - 2
[0033] Among them, minf() is the objective function, i is the i - th pair of matching spatial information of the feature measurement points and the prior measurement point spatial information, 0 < i < n, n is the number of pairs of matching spatial information of the feature measurement points and the prior measurement point spatial information, R is the rotation transformation matrix, t is the translation transformation matrix, , are the corresponding feature measurement point spatial information and prior measurement point spatial information, j and c are the labels of the feature measurement point spatial information and prior measurement point spatial information, X_min is the optimal transformation matrix, and k is the weight of the corresponding feature measurement point spatial information and prior measurement point spatial information with the same number.
[0034] Furthermore, the step of assigning weights to the spatial information of each measuring point and the corresponding priori spatial information of the measuring point according to the sorting result also includes:
[0035] A higher weight is given to the spatial information of the measuring points that are closer to the center point; or a higher weight is given to the spatial information of the measuring points that are smaller in size.
[0036] Further, before sorting the spatial information of each measuring point according to the spatial information of the measuring point and / or the characteristic size information, and assigning weights to the spatial information of each measuring point and the corresponding priori spatial information of the measuring point according to the sorting result, the following steps are included:
[0037] Obtain the deviation index between the spatial information of each feature measuring point and the corresponding priori measuring point spatial information, and judge whether the spatial information of each feature measuring point is qualified based on it. If not, return to step S1 to re-collect the workpiece point cloud data.
[0038] In a second aspect, the present application provides a workpiece dimension correction method, comprising:
[0039] P1: According to any of the above methods, obtain the point cloud data of the current workpiece, and extract the spatial information of each current feature measuring point and the current feature size information;
[0040] P2: Correct the spatial information of each current feature measuring point and the current feature size information according to the correction parameters to obtain the corrected spatial information of the current feature measuring point and the current feature size information.
[0041] In a third aspect, the present application further provides a computer storage medium storing an executable program code; the executable program code is used to execute the calibration parameter determination method described in any one of the first aspects or / and the workpiece size correction method described in any one of the second aspects.
[0042] In a fourth aspect, the present application also provides a terminal device, comprising a memory and a processing module; the memory stores a program code that can be executed by the processing module; the program code is used to execute the calibration parameter determination method described in any one of the first aspects or / and the workpiece size correction method described in any one of the second aspects.
[0043] The present invention provides a calibration parameter determination method, a correction method, a medium and a device. By acquiring the point cloud data of the calibration workpiece, the feature measuring point spatial information and feature size information of each feature are extracted according to the point cloud data, and the corresponding numbers are numbered. Then, the feature measuring point spatial information and the number mapping corresponding to the prior measuring point spatial information are constructed to determine the optimal transformation matrix, so that when the spatial information is converted, the error between the two is minimized. In the subsequent process of obtaining the calibration parameters, no other auxiliary measurement equipment is required. The process is simple, the calibration efficiency is high, and the cost is low. At the same time, due to the small number of equipment types used, the application scope of the present invention can be expanded. Then, according to the optimal transformation matrix, the feature measuring point spatial information, feature size information and the prior measuring point spatial information and prior size information are transformed to the same coordinate system. Finally, the difference between the feature measuring point spatial information, feature size information and the prior measuring point spatial information and prior size information with the same number in the same coordinate system is obtained as the correction parameter. The extracted feature points are corrected and optimized to improve the correction accuracy. The existing technology solves the problems of less application scenarios, unchanged operation, low calibration accuracy and low calibration efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is a flow chart of a method for determining calibration parameters according to an embodiment of the present invention;
[0045] Figure 2 A schematic diagram of a collection device according to an embodiment of the present invention;
[0046] Figure 3 The figure is a flow chart of a workpiece dimension correction method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] It should be noted that if the embodiments of the present invention involve directional indications, such as up, down, left, right, front, back, etc., then the directional indication is only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture. If the specific posture changes, the directional indication will also change accordingly. In addition, if the embodiments of the present invention involve descriptions of "first, second", "S1, S2", "step one, step two", etc., then such descriptions are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of indicated technical features or indicating the execution order of the method, etc. Those skilled in the art can understand that anything that does not violate the gist of the invention under the technical concept of the invention should be included in the protection scope of the present invention.
[0049] like Figure 1 As shown, the present invention provides a method for determining calibration parameters:
[0050] S1: Obtain the point cloud data of the calibration workpiece;
[0051] Specifically, it is optional but not limited to obtaining the workpiece surface point cloud within the acquisition range at several predetermined positions to obtain several calibrated workpiece surface partial point clouds, and then converting all the workpiece surface partial point clouds to the same coordinate system to splice them to obtain the complete calibrated workpiece point cloud data; specifically, each predetermined position preferably surrounds the workpiece so that the complete workpiece surface is within the scanning range of each acquisition device.
[0052] Further preferably, the step of obtaining the point cloud data of the calibration workpiece may optionally include:
[0053] S11: Control the robot to move to several predetermined positions along a priori fixed trajectories to collect and calibrate the surface point cloud of the workpiece, obtain partial point clouds of the surface of the calibrated workpiece in several acquisition device coordinate systems, and obtain the current posture of the robot when it is at each predetermined position;
[0054] Specifically, it is optional but not limited to installing the acquisition device at the end of the robot, and placing the calibration workpiece in front of the robot, and then the robot moves to several predetermined positions along the a priori fixed trajectory, and collects partial surface point cloud data of the calibration workpiece at each predetermined position. At the same time, the robot feeds back the current posture of the end when collecting partial surface point cloud data of the calibration workpiece through the internal controller; the acquisition device, optional but not limited to 3D line scan camera, 3D structured light camera, TOF camera, laser scanner, multi-view stereo vision system, grating projector measuring instrument and other commonly used scanning devices that can be used to obtain three-dimensional data of the surface of an object; it is worth noting that the placement position of the calibration workpiece must be within the range of movement of the robot, and the acquisition device must be able to collect point cloud data of any part of the surface of the calibration workpiece except the bottom, and the collected several partial surface point cloud data must include all points in the complete workpiece point cloud, so as to splice and obtain the complete point cloud of the workpiece; preferably, the acquisition device is installed at the center point of the flange at the end of the robot.
[0055] More preferably, the partial surface point cloud data of the calibration workpiece is collected at each predetermined position, such as Figure 2 As shown, it is optional but not limited to provide a collection device, which is optional but not limited to including a processing module 1, a collection module 2 and a robot 3. The calibration workpiece 4 is placed in front of the robot, and the collection module 2 is driven by the robot 3 to move along a priori fixed trajectory to each predetermined position to collect partial surface point cloud data of several calibration workpieces.
[0056] S12: according to the current posture of the robot when it is located at each predetermined position and the prior transformation matrix between the acquisition device and the robot end, the point cloud of the surface of the calibration workpiece is converted to the robot base coordinate system, and the point cloud data of the calibration workpiece is obtained by splicing;
[0057] Specifically, it is optional but not limited to converting some partial surface point cloud data of the calibrated workpiece in the acquisition device coordinate system to the robot terminal coordinate system according to the current posture of the robot when it is located at each predetermined position, and then obtaining partial surface point cloud data of each calibrated workpiece in the robot base coordinate system according to the prior transformation matrix between the robot terminal and the robot base, and finally splicing several incomplete calibrated workpiece surface point clouds into one point cloud to obtain a complete calibrated workpiece surface point cloud in the robot base coordinate system, which is the point cloud data of the calibrated workpiece.
[0058] For example, the surface point cloud of each calibrated workpiece may be converted to the robot base coordinate system according to the coordinate conversion formula 2-1 to obtain the surface point cloud of each calibrated workpiece in the robot base coordinate system:
[0059] 2-1
[0060] in, To collect the point cloud of the calibration workpiece surface in the equipment coordinate system, is the current position of the robot, and E is the prior transformation matrix between the acquisition device and the robot end.
[0061] After converting the partial point clouds of each calibration workpiece surface to the robot base coordinate system, all point clouds are combined to obtain the complete calibration workpiece surface point cloud, which is the point cloud data of the calibration workpiece.
[0062] Preferably, since there may be many repeated superimposed points in the complete calibration workpiece surface point cloud, it is necessary to optimize them to reduce the amount of data processing in subsequent steps, thereby saving resources and improving efficiency. Therefore, after step S12, it also includes:
[0063] S13: filtering and / or down-sampling the point cloud data of the calibration workpiece to obtain optimized point cloud data of the calibration workpiece.
[0064] Specifically, since there may be repeated point clouds in several partial point clouds of the calibrated workpiece surface acquired by the acquisition device, in order to reduce the amount of data processing in subsequent steps, after obtaining the point cloud data of the calibrated workpiece, the workpiece point cloud can be filtered according to the straight-through filtering method to remove outliers and noise points in the point cloud, and then the point cloud is uniformly down-sampled to simplify the point cloud data structure, so as to obtain the processed point cloud data of the calibrated workpiece, which is the optimized point cloud data of the calibrated workpiece.
[0065] It is worth noting that parameters such as the filtering range in the straight-through filtering method and the downsampling rate in the uniform downsampling method are arbitrarily set by those skilled in the art.
[0066] S2: Extract the feature point spatial information and feature size information of each feature according to the point cloud data, and number them accordingly;
[0067] Specifically, it is optional but not limited to extracting the point clouds of various feature areas in the surface point cloud data of the workpiece according to the prior region of interest, such as circular holes, rectangles, grooves, etc., so as to obtain the coordinates of the feature center points or corner points according to the point clouds of each feature area as feature point space information, and obtain the diameter, width, length and other parameters of the feature according to the coordinate extreme values of the point cloud of the feature area in the coordinate axis as feature size information. The specific form of expression of feature point space information and feature size information, parameter selection, etc. can be determined by technicians in this field according to the specific shape of the feature area, etc.; taking a circular hole as an example, its center coordinates can be used as feature point space information; its diameter can be used as feature size information. At the same time, the corresponding numbers of each feature point space information and feature size information are obtained according to the preset numbers of the prior region of interest; more specifically, the prior region of interest can be optionally but not limited to be obtained according to the workpiece template, structure diagram, etc. of the calibrated workpiece.
[0068] For example, let the spatial information of each feature point be [x j ,y j , z j ], the corresponding feature size information is d j , then the corresponding number can be optionally named name j , we can get the set F of all feature measurement point spatial information and feature size information j [name j , [x j ,y j , z j ],d j ], where j is the jth feature on the calibration workpiece, F j That is, the set of measurement point spatial information and size information of the jth feature.
[0069] Preferably, the steps of extracting the spatial information and the characteristic size information of each characteristic measuring point and numbering them accordingly may optionally include but are not limited to:
[0070] S21: extracting a number of initial feature area point clouds corresponding to the point cloud data according to the a priori region of interest;
[0071] Specifically, it is optional but not limited to extracting point clouds covering the a priori region of interest in the point cloud data based on the a priori region of interest as initial feature region point clouds corresponding to each feature region.
[0072] S22: Fitting a plane to each initial feature region point cloud to obtain a corresponding plane equation and a plane normal vector;
[0073] Specifically, it is optional but not limited to fitting a plane to each initial feature area point cloud according to a parameter estimation method to obtain a plane equation corresponding to each initial feature area point cloud, and obtaining a corresponding plane normal vector according to the parameters of each plane equation; parameter estimation methods include but are not limited to RANSAC (Random Sample Consensus) plane fitting method, least squares method, maximum likelihood estimation, M-estimation and other commonly used methods.
[0074] Example, optional but not limited to setting the plane model:
[0075]
[0076] Among them, A, B, and C are the plane normal vectors V p [v x , v y , v z ] in v x 、v y 、v z , (x, y, z) is the coordinate of any point in the point cloud, [px , p y , p z ] are the coordinates of any point in the plane equation.
[0077] Then, a number of points are randomly selected from the initial feature area point cloud and substituted into the plane model to fit and determine the parameters of the plane model and obtain the corresponding plane equation.
[0078] S23: Projecting each initial feature region point cloud along the plane normal vector to the corresponding plane equation to obtain a projected point cloud;
[0079] Specifically, each initial feature area point cloud can be projected onto the corresponding plane equation along the plane normal vector according to equations 2-2 and 2-3 to obtain a projected point cloud:
[0080] 2-2
[0081] 2-3
[0082] Among them, v x 、v y 、v z is the plane normal vector V p [v x , v y , v z ] weight; [p x , p y , p z ] is the coordinate of any point in the plane equation; z is the ratio of the vertical vector from the regional point cloud to the plane to the normal vector vp, , , are the deviation values between the point coordinates of the initial feature area point cloud and the point coordinates after projection on the x, y, and z axes respectively; [xi, yi, zi] are the point coordinates of the initial feature area point cloud; [x', y', z'] are the point coordinates after projection; Projected point cloud.
[0083] S24: randomly selecting a number of points from the projected point cloud and the initial feature region point cloud to construct a point cloud conversion matrix between the plane equation and the initial feature region point cloud, so as to convert the initial feature region point cloud to the plane equation, and obtain a two-dimensional point cloud image;
[0084] For example, optional [p x , p y , p z ] is used as the origin to establish a plane coordinate system, with the plane normal vector V p As the z-axis, we get the point [p x +v x , p y +vy , p z +v z ], any point in the plane equation whose distance from the origin is 1 [p rx , p ry , p rz ] is the y-axis direction, and three points [0, 0, 0], [0, 0, 1], [0, 1, 0] are selected from the projected point cloud, and equations 2-4 and 2-5 are established to obtain the transformation matrix between the two:
[0085] 2-4
[0086] 2-5
[0087] Among them, T is the translation transformation matrix, Ter[R|T] is the point cloud transformation matrix, [p x , p y , p z ] is the origin of the plane coordinate system, [p x +v x , p y +v y , p z +v z ] is a point on the z-axis of the plane coordinate system, [p rx , p ry , p rz ] is a point on the y-axis of the plane coordinate system.
[0088] S25: acquiring a binary image of the two-dimensional point cloud image, and performing contour extraction on the binary image to obtain an internal contour of the binary image of the two-dimensional point cloud image;
[0089] Specifically, it is optional but not limited to setting a background threshold, and determining whether the pixel value of each pixel in the two-dimensional point cloud image is less than the background threshold. If it is less than, the pixel value of the pixel is modified to the first pixel value, and if it is not less than, the pixel value of the pixel is modified to the second pixel value. When the pixel values of all pixels are modified, a binary image of the two-dimensional point cloud image can be obtained, and then the contour of the binary image of the two-dimensional point cloud image is extracted according to the contour extraction algorithm to obtain the internal contour of the feature coverage area in the binary image; the contour extraction algorithm may optionally include common contour extraction methods such as edge detection algorithm, contour discovery algorithm, and morphological operation method.
[0090] S26: Perform contour fitting on the internal contour to obtain feature points and feature dimensions of the fitted figure, and project them onto the plane equation to obtain feature measurement point spatial information and feature dimension information.
[0091] Specifically, it is optional but not limited to that according to the approximate shape of the internal contour, a technician in this field may use a suitable algorithm to fit the internal contour to obtain a corresponding fitting figure, and obtain its center point or corner point as a feature point according to the geometric features of the fitting figure, and obtain the diameter, width, length and other parameters of the feature as the feature size by using the coordinate extreme values of the fitting figure in the coordinate axis. Then, the feature points and feature sizes are projected to the plane equation to obtain the corresponding feature measurement point space information and feature size information.
[0092] Taking the internal contour as a circle as an example, the internal circular contour C is obtained according to step S25. o After that, the inner circular contour C o Fit the circle to get the center coordinate C center and the circle diameter C d , that is, the characteristic point and characteristic size, according to the existing projection method, the center coordinate C center Projecting onto the plane equation, we get the projection point [x j , y j , z j ], is the spatial information of the characteristic measuring point, the circle diameter C d is the corresponding feature size information.
[0093] Preferably, due to the influence of factors such as the external environment and process conditions, the point cloud data of the calibration workpiece collected by the acquisition device may have certain errors. In order to reduce the errors as much as possible, after step S26, the following steps may be optionally included:
[0094] S27: repeating steps S1-S26 until a set number of feature measurement point spatial information and feature size information is obtained;
[0095] S28: Calculate the average value of the spatial information and the feature size information of the plurality of feature measurement points corresponding to each feature, and obtain the difference between the spatial information and the feature size information of each feature measurement point and the average value;
[0096] S29: Determine whether the difference is less than a difference threshold, if so, retain the feature point spatial information and feature size information, if not, remove the corresponding feature point spatial information and feature size information;
[0097] S210: Obtain average values of several feature measurement point spatial information and feature size information corresponding to each feature in the remaining data, which are the feature measurement point spatial information and feature size information finally determined.
[0098] Specifically, it is optional but not limited to setting a repetition threshold and a difference threshold, repeating steps S1-S26 several times until the number of repetitions is not less than the repetition threshold, and obtaining a set number of feature measurement point spatial information and feature size information. At this time, each feature area corresponds to a number of feature measurement point spatial information and feature size information, and the average value of the two is calculated. Then, the difference between the several feature measurement point spatial information and feature size information corresponding to each feature area and the average value is calculated to determine whether each difference is less than the corresponding difference threshold. If it is not less than, it means that the corresponding feature measurement point spatial information and feature size information have small errors and can be retained. If it is not less than, it means that the corresponding feature measurement point spatial information and feature size information have large errors and need to be eliminated to reduce the error. After eliminating all values with large errors, the average value of the remaining retained values is calculated, which can be used as the feature measurement point spatial information and feature size information corresponding to each feature area.
[0099] S3: According to the spatial information of each characteristic measuring point and the number mapping corresponding to the prior measuring point spatial information, an objective function is constructed to determine the optimal transformation matrix so that the error between the two is minimized when the spatial information is converted;
[0100] Specifically, it is optional but not limited to mapping the spatial information of the feature measuring points with the same number to the corresponding spatial information of the prior measuring points according to the number of each feature measuring point spatial information and the spatial information of the prior measuring points to determine the optimal transformation matrix between the feature measuring points and the prior measuring points, so that when each feature measuring point is converted to the coordinate system where the prior measuring point is located or / and each prior measuring point is converted to the coordinate system where the feature measuring point is located, the gap between the spatial information of all feature measuring points with the same number and the spatial information of the prior measuring points is minimized, that is, the maximum degree of overlap is achieved. For example, if there are multiple measuring points, it can be selected that the sum of the distances between the spatial information of each feature measuring point and the spatial information of the prior measuring points converted to the same coordinate system is minimized.
[0101] Preferably, it is optional but not limited to constructing an objective function based on the feature measurement point spatial information with the same number and the corresponding prior measurement point spatial information, and then preferably solving the optimal solution of the objective function through a regression analysis algorithm, etc., to determine the rotation transformation matrix and the translation transformation matrix between the feature measurement point spatial information and the prior measurement point spatial information, so as to obtain the optimal transformation matrix, so that when the measurement point spatial information is converted, the sum of the distances between each feature measurement point spatial information and the prior measurement point spatial information is the minimum value; the regression analysis algorithm may optionally include but is not limited to common algorithms such as SVD algorithm, QR decomposition algorithm, Cholesky decomposition algorithm, orthogonal decomposition algorithm, etc.; the prior measurement point spatial information may optionally be obtained based on pre-measurements by technicians in this field, technical documents, etc., but is not limited to.
[0102] Further preferably, the calibration workpiece may be calibrated according to a third-party calibration device to obtain the spatial information and prior dimension information of each prior measurement point. The third-party calibration device may preferably include common calibration devices such as a coordinate measuring machine and a laser tracker.
[0103] Exemplarily, the steps of constructing an objective function to determine the optimal transformation matrix according to the spatial information of each characteristic measurement point and the corresponding prior measurement point spatial information through number mapping may preferably but not limited to include:
[0104] S31: Sort the spatial information of each measurement point according to the spatial information of the measurement point or / and the characteristic dimension information, and assign weights to the spatial information of each measurement point and the corresponding prior measurement point spatial information according to the sorting result;
[0105] Specifically, since the sizes of each feature are not necessarily the same and their positions on the workpiece surface are also different, their importance in determining the optimal transformation matrix is also different. Therefore, preferably but not limited to, according to the spatial position, size, etc. of the measurement points, the spatial information of each characteristic measurement point is sorted from near to far from the center point of the workpiece surface or / and from small to large according to the size of the characteristic dimension information corresponding to the spatial information of each characteristic measurement point, and weights are assigned to the spatial information of each characteristic measurement point according to the sorting result. Preferably, preferably but not limited to, the spatial information of each characteristic measurement point is sorted from small to large according to the distance from the center point of the workpiece surface or / and the size of the characteristic dimension information corresponding to the spatial information of each characteristic measurement point, and different weights are assigned to the spatial information of each characteristic measurement point. The weight may preferably be represented as k.
[0106] Further preferably, for the weights k of the spatial information of each characteristic measurement point and the corresponding prior measurement point spatial information, preferably, the spatial information of the measurement point closer to the center point is assigned a higher weight; the spatial information of the measurement point with a smaller size is assigned a higher weight. Because, for the requirements of position positioning, dimension accuracy, etc., the measurement points closer to the center point and the measurement points with smaller sizes have more obvious features and more significant effects.
[0107] S32: Construct an objective function 3-1 according to the spatial information of each characteristic measurement point, the corresponding prior measurement point spatial information, and their weights to determine the optimal transformation matrix 3-2:
[0108] 3-1
[0109] 3-2
[0110] Wherein, minf() is the objective function, i is the i-th pair of matched characteristic measurement point spatial information and prior measurement point spatial information, 0 < i < n, n is the number of pairs of matched characteristic measurement point spatial information and prior measurement point spatial information, R is the rotation transformation matrix, and t is the translation transformation matrix. , , are the corresponding feature point spatial information and prior point spatial information, j, c are the labels of the feature point spatial information and prior point spatial information, X_min is the optimal transformation matrix, and k is the weight of the corresponding feature point spatial information and prior point spatial information with the same number.
[0111] Of course, in order to omit steps, the step of determining the weight in step S31 may not be performed, that is, k=1, and it is considered that the features of each measuring point are equally important, and the objective function is constructed as 3-3:
[0112] 3-3
[0113] Preferably, in step S2, when extracting the spatial information and the characteristic size information of each feature measuring point according to the point cloud data of the workpiece, a large error may be generated, resulting in that when determining the optimal transformation matrix according to the spatial information of each feature measuring point and the corresponding priori measuring point spatial information, the deviation of the obtained optimal transformation matrix is too large, so that the sum of the distances between the spatial information of each feature measuring point and the priori measuring point spatial information is large. Therefore, before step S31, the following method may be optionally included:
[0114] S30: Obtain the deviation index between the spatial information of each feature measuring point and the corresponding priori measuring point spatial information, and judge whether the spatial information of each feature measuring point is qualified based on it. If not, return to step S1 to re-collect the workpiece point cloud data.
[0115] Specifically, it is optional but not limited to setting a difference threshold. According to the numbers of each feature measurement point spatial information and the prior measurement point spatial information, the difference between each corresponding feature measurement point spatial information and the prior measurement point spatial information with the same number is obtained, and it is determined whether it is less than the set difference threshold. If it is less than, it means that when extracting each feature measurement point spatial information in step S1, the deviation index between each feature measurement point spatial information and the corresponding prior measurement point spatial information is small, which can be used to calculate and obtain the optimal transformation matrix. If it is not less than, it means that when extracting each feature measurement point spatial information, the deviation index between each feature measurement point spatial information and the corresponding prior measurement point spatial information is too large, and it is necessary to return to step S1 to extract each feature measurement point spatial information.
[0116] Preferably, it is optional but not limited to setting a weight threshold z, and according to the numbers of each feature measurement point spatial information and the prior measurement point spatial information, the difference between each corresponding feature measurement point spatial information and the prior measurement point spatial information with the same number is obtained, and it is determined whether it is less than the set difference threshold, and the number of differences between all corresponding feature measurement point spatial information and the prior measurement point spatial information that are less than the set difference threshold is counted, which is recorded as n, and the total number of corresponding feature measurement point spatial information and prior measurement point spatial information is m. If n / m is less than the weight threshold z, it means that the deviation index is small and can be used to calculate and obtain the optimal transformation matrix. If it is not less than, it means that the deviation index is too large, and it is necessary to return to step S1 to extract each feature measurement point spatial information.
[0117] Further preferably, it is optional but not limited to setting a total threshold, obtaining the sum of the differences between the spatial information of all corresponding feature measurement points and the prior measurement point spatial information, and judging whether it is less than the set total threshold. If it is less than, it means that the deviation index is small and can be used to calculate the optimal transformation matrix. If it is not less than, it means that the deviation index is too large and it is necessary to return to step S1 to extract the spatial information of each feature measurement point.
[0118] For example, let the difference threshold be 1, any feature point spatial information is (1, 2, 3), and the prior point spatial information with the same number is (2, 4, 5). Then, the distance difference d between the feature point spatial information and the corresponding prior point spatial information can be obtained according to the distance calculation formula 3-4:
[0119] 3-4
[0120] Among them, d is the distance difference between the spatial information of the feature measurement point and the corresponding prior measurement point spatial information, , They are the corresponding feature measurement point spatial information and prior measurement point spatial information respectively.
[0121] Substituting the spatial information of the feature measuring point and the spatial information of the prior measuring point with the same number into Formula 3-4, we can obtain the distance difference d=3 between the two. If it is greater than the difference threshold, it proves that the error generated when collecting the point cloud is too large, and it is necessary to return to step S1 to collect the workpiece point cloud data.
[0122] S4: transforming the spatial information, the characteristic size information, the priori spatial information, and the priori size information of each characteristic measurement point into the same coordinate system according to the optimal transformation matrix;
[0123] Specifically, it is optional but not limited to transforming each feature measurement point spatial information and feature size information to the coordinate system where the prior measurement point spatial information and prior size information are located according to the optimal transformation matrix, or transforming each prior measurement point spatial information and prior size information to the coordinate system where the feature measurement point spatial information and feature size information are located, so that the two are in the same coordinate system to facilitate the calculation of the difference between the two.
[0124] For example, let the set of all prior measurement point spatial information and prior size information be F c [name c ,[x c ,y c , z c ],d c ], and optionally transform the priori measurement point spatial information and priori size information into the coordinate system of the feature measurement point spatial information and feature size information according to formula 4-1:
[0125] 4-1
[0126] in, is the set of all prior measurement point spatial information and prior dimension information before the coordinate system is transformed. is the set of all prior measurement point spatial information and prior dimension information after the coordinate system is transformed. is the optimal transformation matrix.
[0127] S5: Obtain the difference between the spatial information and the characteristic size information of the feature measuring points with the same number in the same coordinate system and the priori spatial information and the priori size information of the measuring points as the correction parameters.
[0128] Specifically, the optimal transformation matrix between the spatial information of each feature measuring point and the prior measuring point spatial information obtained in step S2 can be selected, and the two can be converted to the same coordinate system through step S3. After the alignment and matching between the corresponding measuring point spatial information are achieved, the difference between the updated measuring point spatial information and the updated feature size information with the same number after the transformation and the corresponding prior measuring point spatial information and the prior size information can be calculated as the correction parameters corresponding to each feature.
[0129] For example, the difference between the spatial information and the characteristic size information of the feature measuring points with the same number and the priori spatial information and the priori size information of the measuring points can be calculated through 5-1 and 5-2 as the correction parameters:
[0130] 5-1
[0131] 5-2
[0132] in, To correct the spatial information, To correct the feature size information, To update the coordinates of the measured points, is the priori measurement point spatial information. The correction spatial information and correction feature size information corresponding to each feature are combined to obtain the correction parameters corresponding to each feature.
[0133] In this embodiment, a calibration parameter determination method of the present invention is provided. By acquiring the point cloud data of the calibration workpiece, the feature measuring point spatial information and feature size information of each feature are extracted according to the point cloud data, and the corresponding numbers are assigned. Then, the feature measuring point spatial information and the number mapping correspond to the prior measuring point spatial information, and the objective function is constructed to determine the optimal transformation matrix, so that when the spatial information is converted, the error between the two is minimized. In the subsequent process of obtaining the calibration parameters, no other auxiliary measurement equipment is required, the process is simple, the calibration efficiency is high, and the cost is low. At the same time, due to the small number of equipment types used, the application scope of the present invention can be expanded. Then, according to the optimal transformation matrix, the feature measuring point spatial information, feature size information, prior measuring point spatial information, and prior size information are transformed to the same coordinate system. Finally, the difference between the feature measuring point spatial information, feature size information, prior measuring point spatial information, and prior size information with the same number in the same coordinate system is obtained as the correction parameter. The extracted feature points are corrected and optimized to improve the correction accuracy. The existing technology solves the problems of fewer application scenarios, unchanged operation, low calibration accuracy, and low calibration efficiency.
[0134] like Figure 3 As shown, the present invention also provides a workpiece size correction method:
[0135] P1: According to any of the above methods, obtain the point cloud data of the current workpiece, and extract the spatial information of each current feature measuring point and the current feature size information;
[0136] Specifically, it is possible to obtain point cloud data of the current workpiece according to any of the above calibration parameter determination methods, and extract spatial information and size information of each feature area from the point cloud data of the current workpiece to obtain current feature measurement point spatial information and current feature size information.
[0137] For example, according to the calibration parameter determination method, the point cloud data C of the current workpiece can be obtained. new , and extract the point cloud of each feature area in the surface point cloud data of the workpiece according to the prior area of interest, so as to obtain the coordinates of the feature center point or corner point according to the point cloud of each feature area as the current measurement point spatial information [x j ',y j ', z j '], and according to the coordinate extreme value of the point cloud of the feature area in the coordinate axis, the diameter, width, length and other parameters of the feature are obtained as the current feature size information d j', and at the same time, the corresponding spatial information of each current feature measurement point and the number name of the current feature size information are obtained according to the preset number of the prior area of interest j , get the current feature information set F j '[name j ', [x j ', y j ', z j '], d j ']; More specifically, the a priori region of interest may be obtained, optionally but not limited to, based on a workpiece template, a structural diagram, etc. of the calibration workpiece.
[0138] P2: Correct the spatial information of each current feature measuring point and the current feature size information according to the correction parameters to obtain the corrected spatial information of the current feature measuring point and the current feature size information.
[0139] Specifically, the corresponding correction space information and correction size information may be added to the current feature measurement point space information and the current feature size information to obtain the corrected current measurement point coordinates and the current feature size.
[0140] For example, according to the spatial information of each current feature measurement point [x j ', y j ', z j '] and the number name of the current feature size information j Get the corresponding correction parameter [x o ,y o ,z o ] and [d o ], add the two together to get the corrected spatial information of all current feature measurement points and the current feature size information:
[0141] 22-1
[0142] in, is the set of all corrected current feature point spatial information and current feature size information, t is the tth corrected current feature point spatial information and current feature size information, [x j ', y j ', z j '] and d j ' is the jth current feature measurement point spatial information and current feature size information, [x o ,y o ,z o ] and [d o ] is [x j ', y j ', z j '] and d j'The corresponding correction space information and correction size information, o is the number of the correction space information and correction size information.
[0143] On the other hand, the present invention further provides a computer storage medium storing executable program code; the executable program code is used to execute any of the above-mentioned calibration parameter determination methods and / or any of the above-mentioned workpiece size correction methods.
[0144] On the other hand, the present invention also provides a terminal device, including a memory and a processing module; the memory stores a program code that can be executed by the processing module; the program code is used to execute any of the above-mentioned calibration parameter determination methods and / or any of the above-mentioned workpiece size correction methods.
[0145] Exemplarily, the program code may be divided into one or more modules / units, which are stored in the memory and executed by the processing module to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the program code in the terminal device.
[0146] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processing module and a memory. Those skilled in the art will appreciate that the terminal device may also include an input / output device, a network access device, a bus, etc.
[0147] The processing module may be a central processing unit (CPU), or other general processing modules, a digital signal processing module (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general processing module may be a microprocessing module or the processing module may be any conventional processing module, etc.
[0148] The memory may be an internal storage unit of the terminal device, such as a hard disk or a memory. The memory may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal device. Further, the memory may also include both an internal storage unit of the terminal device and an external storage device. The memory is used to store the program code and other programs and data required by the terminal device. The memory may also be used to temporarily store data that has been output or is to be output.
[0149] The above-mentioned computer storage medium and terminal device are created based on the above-mentioned calibration parameter determination method and / or workpiece size correction method. Their technical functions and beneficial effects are no longer repeated here. The various technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the various technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0150] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A method for determining calibration parameters, characterized in that: include: S1: Obtain the point cloud data of the calibration workpiece; S2: Extract the feature point spatial information and feature size information of each feature according to the point cloud data, and number them accordingly; S3: According to the spatial information of each characteristic measuring point and the number mapping corresponding to the prior measuring point spatial information, an objective function is constructed to determine the optimal transformation matrix so that the error between the two is minimized when the spatial information is converted; S4: transforming the spatial information, the characteristic size information, the priori spatial information, and the priori size information of each characteristic measurement point into the same coordinate system according to the optimal transformation matrix; S5: obtaining the difference between the spatial information and the characteristic size information of the feature measuring points with the same number in the same coordinate system and the priori spatial information and the priori size information of the measuring points as the correction parameters; Among them, the objective function is: The optimal transformation matrix is: Wherein, 0 < i < n, n is the number of matching pairs of the spatial information of the characteristic measurement points and the prior measurement points, R is the rotation transformation matrix, and t is the translation transformation matrix. , are the corresponding spatial information of the characteristic measurement points and the prior measurement points respectively, and k is the weight of the corresponding characteristic measurement point spatial information and the prior measurement point spatial information with the same number.
2. The method according to claim 1, characterized in that The steps of obtaining the point cloud data of the calibration workpiece include: Control the robot to move to several predetermined positions along a priori fixed trajectories to collect and calibrate the surface point cloud of the workpiece, obtain partial point clouds of the surface of the calibrated workpiece in several acquisition device coordinate systems, and obtain the current posture of the robot when it is at each predetermined position; According to the current posture of the robot when it is located at each predetermined position and the prior transformation matrix between the acquisition device and the robot end, the point cloud of the calibration workpiece surface is converted to the robot base coordinate system, and the point cloud data of the calibration workpiece is obtained by splicing; The point cloud data of the calibration workpiece is filtered and / or down-sampled to obtain optimized point cloud data of the calibration workpiece.
3. The method according to claim 1, characterized in that According to the point cloud data, the steps of extracting the feature point spatial information and feature size information of each feature and numbering them accordingly include: S21: extracting a number of initial feature area point clouds corresponding to the point cloud data according to the a priori region of interest; S22: Fitting a plane to each initial feature region point cloud to obtain a corresponding plane equation and a plane normal vector; S23: Projecting each initial feature region point cloud along the plane normal vector to the corresponding plane equation to obtain a projected point cloud; S24: randomly selecting a number of points from the projected point cloud and the initial feature area point cloud to construct a matrix calculation formula, obtain a plane equation and a point cloud conversion matrix of the initial feature area point cloud, so as to convert the initial feature area point cloud to the plane equation and obtain a two-dimensional point cloud image; S25: acquiring a binary image of the two-dimensional point cloud image, and performing contour extraction on the binary image to obtain an internal contour of the binary image of the two-dimensional point cloud image; S26: Perform contour fitting on the internal contour to obtain feature points and feature dimensions of the fitted figure, and project them onto the plane equation to obtain feature measurement point spatial information and feature dimension information.
4. The method according to claim 3, characterized in that According to the point cloud data, the feature point spatial information and feature size information of each feature are extracted and numbered accordingly, and the steps also include: S27: repeating steps S1-S26 until a set number of feature measurement point spatial information and feature size information is obtained; S28: Calculate the average value of the spatial information and the feature size information of the plurality of feature measurement points corresponding to each feature, and obtain the difference between the spatial information and the feature size information of each feature measurement point and the average value; S29: Determine whether the difference is less than a difference threshold, if so, retain the feature point spatial information and feature size information, if not, remove the corresponding feature point spatial information and feature size information; S210: Obtain average values of several feature measurement point spatial information and feature size information corresponding to each feature in the remaining data, which are the feature measurement point spatial information and feature size information finally determined.
5. The method according to any one of claims 1 to 4, characterized in that: The steps of obtaining the optimal transformation matrix according to the spatial information of each characteristic measuring point and the prior measuring point spatial information corresponding to the number mapping include: According to the measuring point spatial information and / or the characteristic size information, the spatial information of each measuring point is sorted, and according to the sorting result, the spatial information of each measuring point and the corresponding prior measuring point spatial information are assigned a weight; According to the spatial information of each characteristic measuring point, the corresponding prior measuring point spatial information and the weights of the two, an objective function is constructed to determine the optimal transformation matrix.
6. The method according to claim 5, characterized in that The step of assigning weights to the spatial information of each measuring point and the corresponding priori measuring point spatial information according to the sorting result also includes: A higher weight is given to the spatial information of the measuring points that are closer to the center point; or a higher weight is given to the spatial information of the measuring points that are smaller in size.
7. The method according to claim 6, characterized in that According to the measuring point spatial information and / or the characteristic size information, the spatial information of each measuring point is sorted, and before the spatial information of each measuring point and the corresponding prior measuring point spatial information are weighted according to the sorting result, the following steps are included: Obtain the deviation index between the spatial information of each feature measuring point and the corresponding priori measuring point spatial information, and judge whether the spatial information of each feature measuring point is qualified based on it. If not, return to step S1 to re-collect the workpiece point cloud data.
8. A workpiece size correction method, characterized in that: include: P1: According to the calibration parameter determination method according to any one of claims 1 to 7, the point cloud data of the current workpiece is obtained, and the spatial information of each current feature measuring point and the current feature size information are extracted; P2: Correct the spatial information of each current feature measuring point and the current feature size information according to the correction parameters to obtain the corrected spatial information of the current feature measuring point and the current feature size information.
9. A computer storage medium, characterized in that An executable program code is stored; the executable program code is used to execute the calibration parameter determination method described in any one of claims 1 to 7 and / or the workpiece size correction method described in claim 8.
10. A terminal device, characterized in that: It comprises a memory and a processing module; the memory stores a program code that can be executed by the processing module; the program code is used to execute the calibration parameter determination method described in any one of claims 1 to 7 or / and the workpiece size correction method described in claim 8.
