Camera calibration method and system
By using feature points and robotic arms to link on the calibration plate, the camera calibration process is simplified, the problems of complex operation and low efficiency in the prior art are solved, and fast and efficient camera calibration and accurate coordinate conversion matrix calculation are achieved.
Patent Information
- Application Number
- CN202410986763.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-22
AI Technical Summary
The existing camera calibration methods are complex in operation, large in calculation and low in calibration efficiency, making it difficult to complete camera calibration quickly and efficiently.
A camera calibration method is provided, using the linkage between feature points on the calibration plate and the robot arm, to obtain feature point coordinates through the camera's image capture, calculate the conversion matrix between the camera and the tool coordinate system, simplifying the calibration process and reducing the calculation amount.
It realizes the simplicity and efficiency of camera calibration, improves calibration accuracy, saves calibration correction steps, and improves camera calibration efficiency.
Smart Images

Figure CN118967827A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine vision technology, and in particular to a camera calibration method and system. Background Art
[0002] At present, the application of machine vision is becoming more and more extensive. Combining machine vision with a robotic arm can be applied to a variety of industrial scenarios. Before use, the camera needs to be calibrated first. The existing checkerboard calibration method generally uses a camera to take multiple photos and calculate feature vectors in multiple postures, which is very cumbersome. In addition, after the camera is calibrated using the existing method, calibration correction is required to achieve the required calibration accuracy. Therefore, the existing camera calibration method is complex to operate, has a large amount of calculation, and has low calibration efficiency. Summary of the invention
[0003] In view of the problems in the prior art, the purpose of the present application is to provide a simple and easy-to-implement camera calibration method and system.
[0004] The first aspect of the present application provides a camera calibration method, comprising the following steps:
[0005] Providing a calibration plate, the calibration plate comprising a first feature point and a second feature point;
[0006] Moving a mechanical arm provided with a camera so that the field of view of the camera at least partially covers the calibration plate, and acquiring an image taken by the camera;
[0007] Processing the image taken by the camera, extracting the first coordinates of the first feature point in the camera coordinate system, so as to determine a first feature matrix of the camera coordinate system;
[0008] When moving the robotic arm so that the tool point of the robotic arm is aligned with the second feature point, the coordinates of the second feature point in the base coordinate system are recorded;
[0009] Calculating a second coordinate of the first feature point in the base coordinate system according to a positional relationship between a preset second feature point and the first feature point;
[0010] Calculate the third coordinate of the first feature point in the tool coordinate system according to the base coordinate system and the rigid transformation matrix of the tool coordinate system when the camera captures the image, so as to determine the second feature matrix of the tool coordinate system;
[0011] A first transformation matrix between the camera coordinate system and the tool coordinate system is calculated according to the first characteristic matrix and the second characteristic matrix.
[0012] In some embodiments, the acquisition of the camera-shot image further includes recording the position information of the tool point of the robot arm in the base coordinate system when the camera shoots the image;
[0013] The rigid transformation matrix between the base coordinate system and the tool coordinate system when the camera captures the image is calculated based on the position information of the tool point of the robot arm in the base coordinate system when the camera captures the image.
[0014] In some embodiments, a plurality of characteristic patterns are provided on the upper surface of the calibration plate, and the first characteristic point is a designated position point in the characteristic pattern;
[0015] Processing the image taken by the camera to extract the first coordinate of the first feature point in the camera coordinate system includes the following steps:
[0016] Performing edge image segmentation on the image taken by the camera to obtain edge image features of characteristic graphics;
[0017] The first coordinates of the first feature point are calculated according to the edge image features of the feature pattern and the position information of the first feature point in the feature pattern.
[0018] In some embodiments, the camera is a 3D camera, and the image captured by the camera is a 3D point cloud image;
[0019] Performing edge image segmentation on the image taken by the camera comprises the following steps:
[0020] Performing plane fitting on the 3D point cloud image to extract the upper surface feature image of the calibration plate;
[0021] Perform edge feature image segmentation on the upper surface feature image to obtain feature pattern edge image features.
[0022] In some embodiments, performing edge feature image segmentation on the upper surface feature image to obtain feature pattern edge image features comprises the following steps:
[0023] Extracting edge point information from the upper surface feature image;
[0024] Segmenting the edge feature image according to the edge point information to obtain an edge image feature group;
[0025] Feature recognition is performed on the edge image feature group to distinguish outer contour edge image features and feature pattern edge image features among the edge image features.
[0026] In some embodiments, after distinguishing the outer contour edge image features and the characteristic pattern edge image features in the edge image features, the following steps are also included:
[0027] The coordinates of the intersection of each two intersecting straight lines in the outer contour edge image feature are calculated by using a straight line fitting method to obtain the coordinates of multiple corner points;
[0028] Calculating the verification coordinates of the first feature point according to the positional relationship between the corner point and the first feature point;
[0029] The verification coordinates of the first feature point are compared with the first coordinates of the first feature point, and the accuracy of the first coordinates is verified according to the comparison result.
[0030] In some embodiments, the calibration plate includes at least three first characteristic points, and the three first characteristic points are not located on the same straight line;
[0031] Wherein, determining the first characteristic matrix of the camera coordinate system includes: determining a first direction vector and a second direction vector according to the first coordinates of the first characteristic point; calculating a third direction vector perpendicular to the first direction vector and the second direction vector, and obtaining a first characteristic matrix including the three direction vectors;
[0032] Among them, determining the second characteristic matrix of the tool coordinate system includes: determining the fourth direction vector and the fifth direction vector according to the third coordinate of the first feature point; calculating the sixth direction vector perpendicular to the fourth direction vector and the fifth direction vector, and obtaining the second characteristic matrix including the three direction vectors.
[0033] In some embodiments, the second feature point coincides with the first feature point, and the first feature point is a specified position point in a feature pattern disposed on the upper surface of the calibration plate.
[0034] In some embodiments, the first feature point and the second feature point do not overlap, the first feature point is a specified position point in a feature pattern disposed on the upper surface of the calibration plate, and the second feature point is a raised point disposed on the upper surface of the calibration plate.
[0035] In some embodiments, after calculating the first transformation matrix of the camera coordinate system and the tool coordinate system, the following steps are also included:
[0036] Calculate a fourth coordinate of the first feature point in a tool coordinate system according to the first transformation matrix and the first coordinate of the first feature point;
[0037] Calculating an offset according to the third coordinate and the fourth coordinate of the first feature point;
[0038] A second transformation matrix between the camera coordinate system and the tool coordinate system is calculated according to the offset and the first transformation matrix.
[0039] In some embodiments, the calibration plate is further provided with a check point, and the method further comprises the following steps:
[0040] Moving the robotic arm so that the robotic arm tool point is aligned with the check point, and recording the coordinates of the check point in the base coordinate system;
[0041] Calculate the fifth coordinate of the check point in the tool coordinate system based on the base coordinate system and the rigid transformation matrix of the tool coordinate system when the camera captures the image;
[0042] Calculating the coordinates of the check point in the camera coordinate system according to the positional relationship between the check point and the first feature point;
[0043] Based on the second transformation matrix, calculating a sixth coordinate of the check point in the tool coordinate system;
[0044] The fifth coordinate and the sixth coordinate of the check point are compared, and the accuracy of the first conversion matrix is checked according to the comparison result.
[0045] A second aspect of the present application further provides a camera calibration system, which is applied to the camera calibration method, and the system comprises:
[0046] A calibration plate, comprising a first characteristic point and a second characteristic point;
[0047] A robotic arm control module, used to control the movement of the robotic arm and control the camera to capture images;
[0048] The camera calibration module is used to perform the following steps:
[0049] When the robot arm is controlled to move by the robot arm control module so that the field of view of the camera at least partially covers the calibration plate, acquiring a camera shot image;
[0050] Processing the image taken by the camera, extracting the first coordinates of the first feature point in the camera coordinate system, so as to determine a first feature matrix of the camera coordinate system;
[0051] When the robot arm control module moves the robot arm to align the robot arm tool point with the second feature point, the coordinates of the second feature point in the base coordinate system are obtained from the robot arm control module and recorded;
[0052] Calculating a second coordinate of the first feature point in the base coordinate system according to a positional relationship between a preset second feature point and the first feature point;
[0053] Calculate the third coordinate of the first feature point in the tool coordinate system according to the base coordinate system and the rigid transformation matrix of the tool coordinate system when the camera captures the image, so as to determine the second feature matrix of the tool coordinate system;
[0054] A first transformation matrix between the camera coordinate system and the tool coordinate system is calculated according to the first characteristic matrix and the second characteristic matrix.
[0055] The camera calibration method and system provided in this application have the following advantages:
[0056] By adopting the camera calibration method of the present application, it is only necessary to take an image in one posture of the robotic arm and locate the second feature point through the robotic arm, and the camera calibration can be completed through corresponding calculations, and the implementation method is simple; the method has low requirements on the calibration plate, the operation method of the staff is very simple, the calculation amount is small, and the camera calibration based on the robotic arm can be completed quickly and efficiently; the method adopts a robotic arm linkage method, and obtains the first coordinate of the first feature point in the camera coordinate system through camera shooting, locates the second feature point through the robotic arm and calculates the second coordinate of the first feature point in the tool coordinate system accordingly. Compared with the existing calibration method, the camera calibration accuracy is improved, the calibration correction step after the calibration is completed is saved, and the camera calibration efficiency is further improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings.
[0058] Figure 1 is a flow chart of a camera calibration method according to an embodiment of the present application;
[0059] Figure 2 It is a structural schematic diagram of a calibration plate according to an embodiment of the present application;
[0060] Figure 3 is a flow chart of obtaining the first coordinates of the first feature point according to an embodiment of the present application;
[0061] Figure 4 is a schematic diagram of a characteristic image of the upper surface of a calibration plate according to an embodiment of the present application;
[0062] Figure 5 is a schematic diagram of determining a first direction vector and a second direction vector in a camera coordinate system according to an embodiment of the present application;
[0063] Figure 6 This is a flow chart of calculating offset and verifying calibration accuracy according to an embodiment of the present application. DETAILED DESCRIPTION
[0064] The example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in a variety of forms and should not be construed as being limited to the embodiments set forth herein; on the contrary, these embodiments are provided so that the present application will be comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their repeated descriptions will be omitted. "Or" and "or" in the specification may both mean "and" or "or". Although the terms "upper", "lower", "between", etc. may be used in this specification to describe different exemplary features and elements of the present application, these terms are used herein only for convenience, such as according to the directions of the examples described in the accompanying drawings. Nothing in this specification should be construed as requiring a specific three-dimensional direction of the structure to fall within the scope of the present application. Although "first" or "second" etc. are used in this specification to represent certain features, they are only used to represent the function, and are not used as a limitation on the number and importance of specific features.
[0065] like Figure 1 As shown, the first aspect of the present application provides a camera calibration method, comprising the following steps:
[0066] S100: providing a calibration plate, wherein the calibration plate comprises a first feature point and a second feature point;
[0067] S200: moving a mechanical arm provided with a camera so that the field of view of the camera at least partially covers the calibration plate, and acquiring an image taken by the camera;
[0068] In this embodiment, the camera is arranged at the end of the robotic arm, and the robotic arm is, for example, a six-axis robotic arm, but the present application is not limited thereto, and the present application can also be applied to robotic arms with other numbers of axes; the image captured by the camera can be acquired by directly communicating with the camera, or by communicating with a robotic arm control module that controls the operation of the robotic arm; the robotic arm is, for example, a robotic arm of an intelligent robot, or can also be a separate robotic arm, and the movement of the robotic arm and the camera shooting action can be controlled by the robotic arm control module;
[0069] Here, the field of view of the camera is made to at least partially cover the calibration plate, and the field of view of the camera needs to cover the portion of the calibration plate having the required first feature point; in order to subsequently identify the outer edge feature, the field of view of the camera can be optionally made to completely cover the calibration plate;
[0070] S300: Processing the image taken by the camera, extracting the first coordinates of the first feature point in the camera coordinate system, so as to determine a first feature matrix of the camera coordinate system;
[0071] S400: moving the robot arm to align the tool point of the robot arm with the second feature point, and recording the coordinates of the second feature point in the base coordinate system;
[0072] The robot tool point here refers to the TCP (Tool Central Point) point at the end of the robot. When the robot tool point is aligned with the second feature point, the coordinates of the second feature point in the base coordinate system can be read from the robot control module; it refers to the center position of the tool or cutter, which is used to describe the position of the tool relative to the robot base coordinate system. In the initial state, the TCP point is the origin of the tool coordinate system. When the robot is manually operated or programmed to approach a point in space, the tool center point is actually moved to that point. Therefore, the trajectory motion of the robot can be regarded as the motion of the tool center point (TCP); the base coordinate system is a rectangular coordinate system based on the robot mounting base and used to describe the motion of the robot;
[0073] S500: Calculating a second coordinate of the first feature point in the base coordinate system according to a positional relationship between a preset second feature point and the first feature point;
[0074] S600: calculating the third coordinate of the first feature point in the tool coordinate system according to the base coordinate system and the rigid transformation matrix of the tool coordinate system when the camera captures the image, so as to determine a second feature matrix of the tool coordinate system;
[0075] S700: Calculate a first transformation matrix of the camera coordinate system and the tool coordinate system according to the first characteristic matrix and the second characteristic matrix.
[0076] By adopting the camera calibration method of the present application, it is only necessary to shoot an image in one posture of the robotic arm and locate the second feature point through the robotic arm, and the camera calibration can be completed through the corresponding calculation, and the implementation method is simple; the method has low requirements for the calibration plate, the operation method of the staff is very simple, the calculation amount is small, and the camera calibration based on the robotic arm can be completed quickly and efficiently. The method adopts a robotic arm linkage method, adopts steps S200~S300, obtains the first coordinate of the first feature point in the camera coordinate system through camera shooting, adopts steps S400~S500, locates the second feature point through the robotic arm and calculates the second coordinate of the first feature point in the tool coordinate system accordingly, and then calculates the first conversion matrix between the camera coordinate system and the working coordinate system through steps S600~S700. Compared with the existing calibration method, this method improves the camera calibration accuracy, saves the calibration correction step after the calibration is completed, and further improves the camera calibration efficiency. After testing, when using a robotic arm with a repeatability of 0.001mm and a 3D camera with a pixel of 0.2mm, the calibration accuracy is within ±0.25.
[0077] In this embodiment, a plurality of characteristic patterns are provided on the upper surface of the calibration plate, and the first characteristic point is a designated position point in the characteristic pattern. When processing the camera-captured image, the x-axis direction and the y-axis direction of the camera coordinate system are determined according to the camera-captured image (such as taking the lower left corner of the image as the zero point, the first extension direction as the x-axis, and the second extension direction as the y-axis). The position and outline of the characteristic pattern are identified in the camera-captured image, and then the first coordinate of the first characteristic point in the camera coordinate system is determined according to the position information of the first characteristic point in the characteristic pattern. The position information of the first characteristic point in the characteristic pattern, for example, includes the first characteristic point at the center point of the characteristic pattern, the first characteristic point at the intersection of the characteristic pattern, or the first characteristic point at the corner point of the characteristic pattern. The first characteristic point does not overlap with the second characteristic point, and the second characteristic point is a protruding point provided on the upper surface of the calibration plate. Since the second characteristic point protrudes from the upper surface of the calibration plate, in step S400, it is easier to move the robot arm so that the TCP point of the robot arm is aligned with the second characteristic point, and it is easier to observe and check the alignment state of the TCP point and the second characteristic point.
[0078] Figure 2 The structure of an exemplary calibration plate is shown. Among them, three characteristic figures A, B, and C are provided on the upper surface of the calibration plate, and the first characteristic point corresponds to the center point of each of the characteristic figures. Among them, the center point of characteristic figure A and the center point of characteristic figure B are located on the first straight line, the center point of characteristic figure A and the center point of characteristic figure B are located on the second straight line, and the first straight line and the second straight line intersect but are not colinear. There is an angle between the first straight line and the second straight line that is not 0°. In this embodiment, the first straight line and the second straight line are perpendicular to each other as an example, that is, the three first characteristic points form a right triangle, the center point of characteristic figure A is used as the right angle point of the right triangle, the center point of characteristic figure B is used as the long side endpoint of the right triangle, and the center point of characteristic figure C is used as the short side endpoint of the right triangle. Four slender needles a, b, c, and d are provided on the calibration plate, wherein the needle tips of needles a, b, and c are second characteristic points respectively, the three second characteristic points are not located on the same straight line, and the needle tip of needle d is a check point. Figure 2The calibration plate structure in is only an example, and there may be other variations in different embodiments. The number and position of the first feature point and the second feature point can be adjusted as needed. The feature pattern is not limited to a circle, and may also be a square, a triangle, a pentagon, or other shapes that can be determined by image recognition. The second feature point may also be the vertex of a protrusion of other shapes, and it is not necessarily required to be in the form of a slender needle. In an alternative embodiment, the second feature point may also be in the form of a position point in a groove, or the groove may be used to assist the robot arm in locating the TCP point and the second feature point. In another alternative embodiment, the second feature point may also coincide with the first feature point, for example, the center of the circle A, B, and C is used as both the first feature point and the second feature point. In step S400, the robot arm is moved so that the TCP point is aligned with the center of the circle, and the coordinates of the second feature point in the tool coordinate system are obtained, which can be directly used as the second coordinates of the first feature point. In another alternative embodiment, the feature pattern may be in the form of a cross groove or a cross protrusion, and the center point of the cross is used as the first feature point and the second feature point at the same time, which also belongs to the protection scope of the present application.
[0079] The following Figure 2 The implementation of the camera calibration method is described in detail using the calibration board shown in FIG. Figure 2 The calibration plate shown in and the following description are not intended to limit the scope of protection of the present application.
[0080] In this embodiment, in the step S200, when acquiring the camera image, it also includes recording the position information of the tool point of the manipulator in the base coordinate system when the camera takes the image. The rigid transformation matrix of the base coordinate system and the tool coordinate system when the camera takes the image is calculated based on the position information of the tool point of the manipulator in the base coordinate system when the camera takes the image. The step of calculating the rigid transformation matrix is performed after step S200 and needs to be completed before step S600, that is, there is no execution order requirement between this step and steps S300 to S500.
[0081] In this embodiment, the position information of the tool point of the robot arm in the base coordinate system when the camera captures the image can be read from the robot arm control module, including the coordinate values and posture information of the x, y, and z axes of the base coordinate system, which is recorded as P here. cap ={x cap ,y cap ,z cap ,w cap ,p cap ,r cap}. According to the rotation mode of the robot arm, based on the position information P capTo calculate the rigid transformation matrix from the origin of the base coordinate system to the tool point at the end of the robot arm. Here, the robot arm external rotation xyz sequence is taken as an example. cap Abbreviated as P cap = {X, Y, Z, W, P, R}, calculate the rigid transformation matrix R BtE as follows:
[0082]
[0083] In this embodiment, the camera is a 3D camera disposed at the end of the robotic arm, and the image captured by the camera is a 3D point cloud image. Figure 3 As shown, in the step S300, the image captured by the camera is processed to extract the first coordinate of the first feature point in the camera coordinate system, including the following steps:
[0084] S310: performing plane fitting on the 3D point cloud image to extract a feature image of the upper surface of the calibration plate; Figure 4 The upper surface feature image of the calibration plate is schematically shown;
[0085] Specifically, after acquiring the 3D point cloud image, performing outlier noise filtering, through filtering and other operations on the point cloud image, extracting the calibration plate point cloud feature image, performing plane geometry on the calibration plate point cloud feature image, extracting the upper surface feature image of the calibration plate, the upper surface feature image including the upper surface point cloud information of the calibration plate;
[0086] Performing edge feature image segmentation on the upper surface feature image to obtain feature pattern edge image features; specifically, the method comprises the following steps:
[0087] S320: extracting edge point information from the upper surface feature image; for example, the Alpha Shapes algorithm may be used to quickly extract edge point information on the upper surface of the calibration plate;
[0088] S330: Segmenting the edge feature image according to the edge point information to obtain an edge image feature group;
[0089] S340: performing feature recognition on the edge image feature group to distinguish outer contour edge image features and feature graphic edge image features in the edge image features;
[0090] For example, a hu moment graphic recognition method may be used to perform graphic recognition on the edge feature image feature group to distinguish the outer contour edge image features and the characteristic graphic edge image features;
[0091] like Figure 2As shown, the calibration plate is provided with a chamfer on the side opposite to the characteristic pattern A, which makes it easier to distinguish the outer contour edge image features from the characteristic pattern edge image features, and after the outer contour edge image features are identified, different characteristic patterns can be distinguished according to the positional relationship between the outer contour edge image features and each characteristic pattern, so as to be used for the subsequent determination of the long side endpoints, right angle points and short side endpoints of the right triangle. The chamfer is provided here only as an example. In other alternative embodiments, the calibration plate can also be provided with other edge shapes at other positions, which also falls within the scope of protection of this application;
[0092] S350: Calculate the coordinates of the intersection of each two intersecting straight lines in the outer contour edge image feature by using a straight line fitting method, take the intersection as the corner point of the outer contour, and obtain the coordinates of n corner points in the camera coordinate system, recorded as Among them, P cornor_i ={x i ,y i ,z i}.
[0093] S360: Calculate the verification coordinates of the first feature point according to the positional relationship between the corner point and the first feature point; specifically, the positional relationship between the corner point and the first feature point may include a distance between the corner point and the first feature point in the x-axis direction and a distance between the corner point and the first feature point in the y-axis direction, and adjust the coordinates of the corner point in the camera coordinate system according to the distance to obtain the verification coordinates of the first feature point in the camera coordinate system;
[0094] S370: Calculate the first coordinate of the first feature point according to the edge image feature of the feature pattern and the position information of the first feature point in the feature pattern; take the feature pattern including three circles and the first feature point as the circle center as an example, that is, obtain the first coordinate of the circle center of each circular edge image feature in the camera coordinate system, recorded as P center_Set = {P center_1 ,P center_2 ,P center_3}, where P center_i ={x i ,y i ,z i}.
[0095] S380: Compare the check coordinates of the first feature point with the first coordinates of the first feature point, and check the accuracy of the first coordinates according to the comparison result. That is, calculate the difference between the check coordinates of the first feature point and the first coordinates, and determine whether the difference is within the preset allowable difference range. If so, the accuracy check of the first coordinate passes, and continue to execute the subsequent steps. Otherwise, the accuracy check of the first coordinate fails, and step S300 is repeated until the accuracy check of the first coordinate passes. Therefore, in this embodiment, the accuracy of the calculation of the first coordinate of the first feature point is guaranteed by steps S350, S360 and S380.
[0096] In step S300, determining the first characteristic matrix of the camera coordinate system includes:
[0097] Determine a first direction vector and a second direction vector according to the first coordinates of the first feature point;
[0098] like Figure 4 As shown, the center point of the characteristic figure A is taken as the right angle point of the right triangle, and its first coordinate is marked as P center_cornorPnt The center point of the characteristic figure B is the endpoint of the long side of the right triangle, and its first coordinate is marked as P center_longPnt The center point of the characteristic figure C is the endpoint of the short side of the right triangle, and its first coordinate is marked as P center_shortPnt , and get a new set of circle center points:
[0099] P center_Set = {P center_longPnt ,P center_cornorPnt ,P center_shortPnt}, where P center_str ={x i ,y i ,z i};
[0100] Take the right angle point of the right triangle as the starting point and the endpoint of the long side of the right triangle as the end point, and calculate the first direction vector. Normalize the vector like Figure 5 As shown, the vector from the center point of characteristic pattern A to the center point of characteristic pattern B is the first direction vector;
[0101] Take the right angle point of the right triangle as the starting point and the endpoint of the short side of the right triangle as the end point, and calculate the second direction vector. Normalize the vector like Figure 5 As shown, the vector from the center point of the characteristic pattern A to the center point of the characteristic pattern C is the second direction vector;
[0102] Calculate a third direction vector perpendicular to the first direction vector and the second direction vector to obtain a first characteristic matrix including the three direction vectors;
[0103] Specifically, the first direction vector is cross-multiplied with the second direction vector to obtain the plane normal vector as the third direction vector. The calculated eigenvectors form the first eigenmatrix of the camera coordinate system
[0104] In this embodiment, in step S400, when the robot arm is moved to align the robot arm tool point with the second feature point, the coordinates of the second feature point in the base coordinate system are recorded and recorded as P teachSet0 = {P teach10 , P teach20 , P teach30 , P teach4}, where P teachi ={x i ,y i , z i};P teach10 , P teach20 , P teach30 are the coordinates of the second feature points corresponding to the needle tips of needles a, b, and c in the base coordinate system, P teach4 is the coordinate of the check point corresponding to the needle tip of needle d in the base coordinate system;
[0105] In the step S500, the second coordinate of the first feature point in the base coordinate system is calculated based on the positional relationship between the preset second feature point and the first feature point, which is denoted as P teachSet = {P teach1 , P teach2 , P teach3 , P teach4}, where P i ={x i ,y i , z i}, P teach1 , P teach2 , P teach3are the second coordinates of each first feature point corresponding to the center of the characteristic figures B, A, and C in the base coordinate system; the positional relationship between the second feature point and the first feature point preset here may include, for each second feature point, the actual distance from the second feature point to each first feature point in two directions (the AB direction and the AC direction), and through this positional relationship, the coordinates of the second feature point in the base coordinate system can be converted into the second coordinates of the first feature point in the base coordinate system; in this embodiment, the three second feature points also form a right triangle, one second feature point is located on the straight line AB, one second feature point is located on the straight line AC, and the other second feature point serves as the right angle point of the right triangle, but the present application is not limited thereto;
[0106] In step S600, based on the rigid transformation matrix R of the tool coordinate system when the camera captures the image, BtE , calculate the third coordinate set of the first feature point in the tool coordinate system as:
[0107] In step S600, determining the second characteristic matrix of the tool coordinate system includes the following steps:
[0108] Determine a fourth direction vector and a fifth direction vector according to the third coordinate of the first feature point;
[0109] According to the arrangement order of the first feature points, the center point of the feature figure A is also taken as the right angle point of the right triangle, and its third coordinate is P tool_cornorPnt , the center point of the characteristic figure B is the endpoint of the long side of the right triangle, and its third coordinate is P tool_longPnt The center point of the characteristic figure C is the endpoint of the short side of the right triangle, and its third coordinate is P tool_shortPnt , the third coordinate set of the first feature point in the tool coordinate system is obtained as:
[0110] P tool_Set = {P tool_longPnt , P tool_cornorPnt , P tool_shortPnt , P tool_checkPnt}, where P tool_str ={x i ,y i , z i};P tool_checkPnt Equal to the above R BtE *P teach4 , is the fifth coordinate of the check point in the tool coordinate system;
[0111] Take the right angle point of the right triangle as the starting point and the endpoint of the long side of the right triangle as the end point, and calculate the fourth direction vector. Normalize the vector
[0112] Step 8.2: Take the right angle point of the right triangle as the starting point and the endpoint of the short side of the right triangle as the end point, and calculate the fifth direction vector. Normalize the vector
[0113] Calculate a sixth direction vector perpendicular to the fourth direction vector and the fifth direction vector to obtain a second characteristic matrix including the three direction vectors;
[0114] Specifically, the fourth direction vector is cross-multiplied with the fifth direction vector to obtain the plane normal vector as the sixth direction vector. The second characteristic matrix of the tool coordinate system is obtained, which is recorded as
[0115] In step S700, a first transformation matrix R between the camera coordinate system and the tool coordinate system is calculated according to the first characteristic matrix and the second characteristic matrix. CtE =R robot *R camera -1 , that is, R robot =R CtE *R camera Here, the first transformation matrix is the rotation matrix from the camera coordinate system to the tool coordinate system.
[0116] like Figure 6 As shown, in this embodiment, after the step S700: calculating the first transformation matrix of the camera coordinate system and the tool coordinate system, it also includes the steps of calculating the offset and correcting the first transformation matrix based on the offset, which specifically includes the following steps:
[0117] S810: Calculate the fourth coordinate of the first feature point in the tool coordinate system according to the first transformation matrix and the first coordinate of the first feature point; any first feature point among the above-mentioned multiple first feature points can be selected for calculation. Here, the first feature point corresponding to the center point A is selected as an example. The calculation method of the fourth coordinate is: P center_cornorPnt_AfterTransform =R CtE *P center_cornorPnt ; If another first feature point is selected, the corresponding fourth coordinate can be obtained by multiplying its first coordinate by the first transformation matrix;
[0118] S820: Calculate an offset according to the third coordinate and the fourth coordinate of the first feature point; specifically, the offset is calculated as follows:
[0119]
[0120] S830: Calculate a second transformation matrix of the camera coordinate system and the tool coordinate system according to the offset and the first transformation matrix; specifically, the second transformation matrix is calculated as follows:
[0121]
[0122] The second conversion matrix is a rigid body transformation matrix from the camera coordinate system to the tool coordinate system, and can be used in subsequent process operations based on the robot arm equipped with a camera.
[0123] As described above, when executing step S400, it also includes moving the mechanical arm so that when the tool point of the mechanical arm is aligned with the check point, the coordinates of the check point in the base coordinate system are recorded. In step S600, when calculating the third coordinate of the first feature point in the tool coordinate system, it also includes calculating the fifth coordinate P of the check point in the tool coordinate system based on the rigid transformation matrix of the base coordinate system and the tool coordinate system when the camera captures the image. tool_checkPnt =R BtE *P teach4 .
[0124] like Figure 6 As shown, after step S830, the method further includes a step of verifying the accuracy of the second transformation matrix based on the check points, which specifically includes the following steps:
[0125] S910: Calculate the coordinates of the check point in the camera coordinate system according to the positional relationship between the check point and the first feature point; specifically, calculate the coordinates P of the check point in the camera coordinate system according to the distance between the check point and the first feature point and the first coordinate of the first feature point in the camera coordinate system. camera_checkPnt ={x, y, z, 1}; In this embodiment, the positional relationship between the check point and the first feature point may include the positional relationship between the check point and the three first feature points respectively, and the coordinates of the check point in the camera coordinate system may be calculated according to the first coordinates of the three first feature points and the positional relationship;
[0126] S920: Calculate a sixth coordinate of the check point in the tool coordinate system based on the second transformation matrix;
[0127] Specifically, based on the coordinates of the check point in the camera coordinate system and the second transformation matrix, the sixth coordinate of the check point in the tool coordinate system is equal to P′ tool_checkPnt =RT CtE *P camera_checkPnt ; Among them, P′ tool_checkPnt ={x′,y′,z′,1};
[0128] S930: Compare the fifth coordinate P of the check point tool_checkPnt and the sixth coordinate P′ tool_checkPnt , verifying the accuracy of the first transformation matrix according to the comparison result;
[0129] Specifically, the error between the fifth coordinate and the sixth coordinate of the check point in the tool coordinate system is calculated as When Δ<ε(set error range), it is considered that the accuracy of the calibration result meets the requirements, and the process of the camera calibration method is terminated. Otherwise, it is determined that the accuracy of the calibration result does not meet the requirements, and the process of the camera calibration method is re-executed until the error is less than the set error range.
[0130] The embodiment of the present application further provides a camera calibration system, which is applied to the camera calibration method, and the system includes:
[0131] The calibration plate includes a first feature point and a second feature point; the first feature point and the second feature point may be overlapping feature points or non-overlapping feature points. The calibration plate may be, for example, Figure 2 The shapes shown, but the application is not limited thereto;
[0132] A robotic arm control module, used to control the movement of the robotic arm and control the camera to capture images;
[0133] The camera calibration module is used to perform the following steps:
[0134] When the robot arm is controlled to move by the robot arm control module so that the field of view of the camera at least partially covers the calibration plate, acquiring a camera shot image;
[0135] Processing the image taken by the camera, extracting the first coordinates of the first feature point in the camera coordinate system, so as to determine a first feature matrix of the camera coordinate system;
[0136] When the robot arm control module moves the robot arm to align the robot arm tool point with the second feature point, the coordinates of the second feature point in the base coordinate system are obtained from the robot arm control module and recorded;
[0137] Calculating a second coordinate of the first feature point in the base coordinate system according to a positional relationship between a preset second feature point and the first feature point;
[0138] Calculate the third coordinate of the first feature point in the tool coordinate system according to the base coordinate system and the rigid transformation matrix of the tool coordinate system when the camera captures the image, so as to determine the second feature matrix of the tool coordinate system;
[0139] A first transformation matrix between the camera coordinate system and the tool coordinate system is calculated according to the first characteristic matrix and the second characteristic matrix.
[0140] By adopting the camera calibration system of the present application, it is only necessary to take an image in one posture of the robotic arm and locate the second feature point through the robotic arm, and the camera calibration can be completed through corresponding calculations, and the implementation method is simple; the system has low requirements for the calibration plate, the operation method of the staff is very simple, the calculation amount is small, and the camera calibration based on the robotic arm can be completed quickly and efficiently; the system adopts a robotic arm linkage method, and obtains the first coordinate of the first feature point in the camera coordinate system through camera shooting, locates the second feature point through the robotic arm and calculates the second coordinate of the first feature point in the tool coordinate system accordingly. Compared with the existing calibration system, the camera calibration accuracy is improved, the calibration correction step after the calibration is completed is saved, and the camera calibration efficiency is further improved.
[0141] The implementation of each step in the system can adopt the specific implementation of the above-mentioned camera calibration method, which will not be repeated here.
[0142] The above content is a further detailed description of the present application in combination with specific preferred implementation methods, and it cannot be determined that the specific implementation of the present application is limited to these descriptions. For ordinary technicians in the technical field to which the present application belongs, several simple deductions or substitutions can be made without departing from the concept of the present application, which should be deemed to fall within the scope of protection of the present application.
Claims
1. A camera calibration method, characterized in that: The steps include: Providing a calibration plate, the calibration plate comprising a first feature point and a second feature point; Moving a mechanical arm provided with a camera so that the field of view of the camera at least partially covers the calibration plate, and acquiring an image taken by the camera; Processing the image taken by the camera, extracting the first coordinates of the first feature point in the camera coordinate system, so as to determine a first feature matrix of the camera coordinate system; When moving the robotic arm so that the tool point of the robotic arm is aligned with the second feature point, the coordinates of the second feature point in the base coordinate system are recorded; Calculating a second coordinate of the first feature point in the base coordinate system according to a positional relationship between a preset second feature point and the first feature point; Calculate the third coordinate of the first feature point in the tool coordinate system according to the base coordinate system and the rigid transformation matrix of the tool coordinate system when the camera captures the image, so as to determine the second feature matrix of the tool coordinate system; A first transformation matrix between the camera coordinate system and the tool coordinate system is calculated according to the first characteristic matrix and the second characteristic matrix.
2. The camera calibration method according to claim 1, characterized in that: The acquisition of the camera-shot image also includes recording the position information of the tool point of the robot arm in the base coordinate system when the camera shoots the image; The rigid transformation matrix between the base coordinate system and the tool coordinate system when the camera captures the image is calculated based on the position information of the tool point of the robot arm in the base coordinate system when the camera captures the image.
3. The camera calibration method according to claim 1, characterized in that: The upper surface of the calibration plate is provided with a plurality of characteristic patterns, and the first characteristic point is a designated position point in the characteristic pattern; Processing the image taken by the camera to extract the first coordinate of the first feature point in the camera coordinate system includes the following steps: Performing edge image segmentation on the image taken by the camera to obtain edge image features of characteristic graphics; The first coordinates of the first feature point are calculated according to the edge image features of the feature pattern and the position information of the first feature point in the feature pattern.
4. The camera calibration method according to claim 3, characterized in that: The camera is a 3D camera, and the image captured by the camera is a 3D point cloud image; Performing edge image segmentation on the image taken by the camera comprises the following steps: Performing plane fitting on the 3D point cloud image to extract the upper surface feature image of the calibration plate; Perform edge feature image segmentation on the upper surface feature image to obtain feature pattern edge image features.
5. The camera calibration method according to claim 4, characterized in that: Performing edge feature image segmentation on the upper surface feature image to obtain feature pattern edge image features comprises the following steps: Extracting edge point information from the upper surface feature image; Segmenting the edge feature image according to the edge point information to obtain an edge image feature group; Feature recognition is performed on the edge image feature group to distinguish outer contour edge image features and feature pattern edge image features among the edge image features.
6. The camera calibration method according to claim 5, characterized in that: After distinguishing the outer contour edge image features and the characteristic pattern edge image features in the edge image features, the following steps are also included: The coordinates of the intersection points of each two intersecting straight lines in the outer contour edge image feature are calculated by using a straight line fitting method to obtain the coordinates of multiple corner points; Calculating the verification coordinates of the first feature point according to the positional relationship between the corner point and the first feature point; The verification coordinates of the first feature point are compared with the first coordinates of the first feature point, and the accuracy of the first coordinates is verified according to the comparison result.
7. The camera calibration method according to claim 1, characterized in that: The calibration plate includes at least three first characteristic points, and the three first characteristic points are not located on the same straight line; Wherein, determining the first characteristic matrix of the camera coordinate system includes: determining a first direction vector and a second direction vector according to the first coordinates of the first characteristic point; calculating a third direction vector perpendicular to the first direction vector and the second direction vector, and obtaining a first characteristic matrix including the three direction vectors; Among them, determining the second characteristic matrix of the tool coordinate system includes: determining the fourth direction vector and the fifth direction vector according to the third coordinate of the first feature point; calculating the sixth direction vector perpendicular to the fourth direction vector and the fifth direction vector, and obtaining the second characteristic matrix including the three direction vectors.
8. The camera calibration method according to claim 1, characterized in that: The second feature point coincides with the first feature point, and the first feature point is a designated position point in a feature pattern disposed on the upper surface of the calibration plate.
9. The camera calibration method according to claim 1, characterized in that: The first feature point and the second feature point do not overlap, the first feature point is a specified position point in a feature pattern set on the upper surface of the calibration plate, and the second feature point is a protruding point set on the upper surface of the calibration plate.
10. The camera calibration method according to claim 1, characterized in that: After calculating the first transformation matrix of the camera coordinate system and the tool coordinate system, the following steps are also included: Calculate a fourth coordinate of the first feature point in a tool coordinate system according to the first transformation matrix and the first coordinate of the first feature point; Calculating an offset according to the third coordinate and the fourth coordinate of the first feature point; A second transformation matrix between the camera coordinate system and the tool coordinate system is calculated according to the offset and the first transformation matrix.
11. The camera calibration method according to claim 10, characterized in that: The calibration plate is also provided with a check point, and the method further comprises the following steps: Moving the robotic arm so that the robotic arm tool point is aligned with the check point, and recording the coordinates of the check point in the base coordinate system; Calculate the fifth coordinate of the check point in the tool coordinate system based on the base coordinate system and the rigid transformation matrix of the tool coordinate system when the camera captures the image; Calculating the coordinates of the check point in the camera coordinate system according to the positional relationship between the check point and the first feature point; Based on the second transformation matrix, calculating a sixth coordinate of the check point in the tool coordinate system; The fifth coordinate and the sixth coordinate of the check point are compared, and the accuracy of the first conversion matrix is checked according to the comparison result.
12. A camera calibration system, characterized in that: The camera calibration method according to any one of claims 1 to 11, wherein the system comprises: A calibration plate, comprising a first characteristic point and a second characteristic point; A robotic arm control module, used to control the movement of the robotic arm and control the camera to capture images; The camera calibration module is used to perform the following steps: When the robot arm is controlled to move by the robot arm control module so that the field of view of the camera at least partially covers the calibration plate, acquiring a camera shot image; Processing the image taken by the camera, extracting the first coordinates of the first feature point in the camera coordinate system, so as to determine a first feature matrix of the camera coordinate system; When the robot arm control module moves the robot arm to align the robot arm tool point with the second feature point, the coordinates of the second feature point in the base coordinate system are obtained from the robot arm control module and recorded; Calculating a second coordinate of the first feature point in the base coordinate system according to a positional relationship between a preset second feature point and the first feature point; Calculate the third coordinate of the first feature point in the tool coordinate system according to the base coordinate system and the rigid transformation matrix of the tool coordinate system when the camera captures the image, so as to determine the second feature matrix of the tool coordinate system; A first transformation matrix between the camera coordinate system and the tool coordinate system is calculated according to the first characteristic matrix and the second characteristic matrix.
Citation Information
Patent Citations
Hand-eye calibration method based on feature points
CN110238820A
Industrial robot teaching system and method based on 3D camera
CN113524147A
Robot calibration method and system based on VTK feature point transformation and storage medium
CN115431278A
Hand-eye calibration method and hand-eye calibration device for robot arm
US20240009849A1
Cited By
Mechanical arm calibration method based on single camera
CN121650001A
Single-camera based robot calibration method
CN121650001B
