Visual calibration method, computer device, and storage medium
The conversion relationship between camera pixel coordinates and machine coordinates is obtained through visual calibration method, which solves the problems of long calibration time and high environmental requirements in the nine-point calibration method, and realizes an efficient and simple calibration process, which is suitable for the application of screw machine production lines.
Patent Information
- Application Number
- CN202210342950.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-02
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2042-04-02
AI Technical Summary
When the existing nine-point calibration method obtains the physical conversion relationship between camera pixel coordinates and machine coordinates, the calibration work time is long and the working environment is high, resulting in certain troubles in actual engineering applications.
A visual calibration method is proposed. By obtaining the pixel equivalent value of the camera, calculating the actual distance between any reference point and the center of the camera, and obtaining the actual relative distance between the center of the camera and the end of the robot execution, the conversion relationship between the pixel coordinates of the camera and the end of the robot execution is obtained, and the position of the reference point in the robot coordinate system is obtained.
This method reduces calibration calculation time, improves calibration efficiency, and simplifies the calibration process of the screw machine, making it simple to operate, have good flexibility, short time period, and is easy to realize the production requirements of the screw machine production line.
Smart Images

Figure CN114663500B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of camera calibration, and particularly relates to a vision calibration method, a computer device, and a storage medium. Background Art
[0002] Camera calibration in the field of computer vision is an important research topic and is the basis for 3D reconstruction and vision measurement. In scenarios with high requirements for the accuracy of the vision system, the calibration process of the camera often needs to be completed with the help of a target with known geometric dimensions. At the same time, camera calibration is a basic requirement for obtaining three-dimensional information from two-dimensional images in the field of computer vision and is an essential step for completing many vision tasks. Its purpose is to determine the internal geometric and optical characteristics (internal parameters) of the camera and the coordinate relationship of the camera in the three-dimensional world (external coefficients). Its main function is to obtain the pixel equivalent of the camera and solve the affine transformation matrix from the image coordinates to the two-dimensional coordinates. With the continuous development of machine vision and the popularization of cameras, it is very necessary for the vision positioning field to use a simple and flexible calibration method to complete vision-related work.
[0003] Currently, the nine-point calibration is a widely used two-dimensional hand-eye calibration in industry. When grasping an object from a fixed plane for operations such as assembly, most industrial application scenarios adopt this method. Similar to general hand-eye calibration, the result of the nine-point calibration is the transformation matrix between the camera coordinate system and the tool coordinate system, and the transformation matrix between the camera coordinate system and the workpiece coordinate system.
[0004] It can be understood that by obtaining the physical conversion relationship between the camera pixel coordinates and the machine coordinates through nine-point calibration, its calibration accuracy is high and its applicability is strong. However, this method requires taking at least 9 calibration plate images at different angles and obtaining a matrix of nine points to complete the calibration. The calibration work takes a long time and has high requirements for the working environment, which brings certain troubles in actual engineering applications. Summary of the Invention
[0005] The purpose of the embodiments of this application is to propose a vision calibration method, a computer device, and a storage medium, which can solve the technical problems such as long calibration work time and high requirements for the working environment brought by obtaining the physical conversion relationship between the camera pixel coordinates and the machine coordinates through nine-point calibration in the prior art.
[0006] To solve the above technical problems, an embodiment of the present application provides a vision calibration method, and the calibration method includes: obtaining the pixel equivalent value of a camera; calculating the actual distance from any reference point to the camera center according to the pixel equivalent value; obtaining the actual relative distance between the camera center and the execution end of the robot; obtaining the conversion relationship between the pixel coordinates of the camera and the execution end of the robot according to the actual distance from the reference point to the camera center and the distance of the camera center relative to the execution end of the robot; and obtaining the position of the reference point in the robot coordinate system according to the conversion relationship.
[0007] Among them, the obtaining the pixel equivalent value of the camera further includes: corresponding the robot coordinate system and the camera coordinate system; creating a first reference point in the camera field of view; positioning the first pixel coordinate of the first reference point; controlling the robot to move a preset distance in any direction; determining the second pixel coordinate of the first reference point after moving the preset distance; and obtaining the pixel equivalent of the camera according to the absolute value of the difference between the first pixel coordinate and the second pixel coordinate and the preset distance moved by the robot.
[0008] Among them, the positioning the first pixel coordinate of the first reference point further includes: establishing an outer contour template of the first reference point; searching and matching in the first image using the parameters of the outer contour template; and taking the position with the highest matching score as the first pixel coordinate of the first reference point.
[0009] Among them, the determining the second pixel coordinate of the first reference point after moving the preset distance further includes: establishing an outer contour template of the first reference point; searching and matching in the second image using the parameters of the outer contour template; and taking the position with the highest matching score as the second pixel coordinate of the first reference point.
[0010] Among them, the corresponding the robot coordinate system and the camera coordinate system further includes: creating a second reference point in the camera field of view; fixing the second reference point, and moving the camera along the first direction and the second direction of the robot respectively; determining whether the direction change of the pixel coordinates of the second reference point is consistent with the actual moving direction of the second reference point; and if the determination is no, swapping the robot coordinate system and the camera coordinate system.
[0011] Among them, the calculating the actual distance from any reference point to the camera center according to the pixel equivalent value further includes: obtaining the pixel coordinates of the camera center and the pixel coordinates of any reference point; calculating the difference between the pixel coordinates of the camera center and any reference point; and obtaining the actual distance from any reference point to the camera center according to the pixel equivalent value of the camera and the pixel coordinate difference.
[0012] Among them, the obtaining of the actual relative distance between the camera center and the end effector of the robot further includes: mapping the coordinates of the camera center and the coordinates of the end effector of the robot to the same actual position; obtaining the coordinate difference between the camera center and the end effector of the robot; and calculating the actual relative distance between the camera center and the end effector of the robot according to the coordinate difference.
[0013] Among them, the obtaining of the position of the reference point in the robot coordinate system according to the conversion relationship further includes: obtaining the image coordinate position of the reference point by using shape matching; and obtaining the position of the reference point in the robot coordinate system according to the image coordinate position and the conversion relationship.
[0014] To solve the above technical problems, an embodiment of the present application further provides a computer device, including a memory and a processor. A computer-readable instruction is stored in the memory, and when the processor executes the computer-readable instruction, the steps of the vision calibration method as described in any one of the above are implemented.
[0015] To solve the above technical problems, an embodiment of the present application further provides a computer-readable storage medium, adopting the following technical solution: A computer-readable instruction is stored on the computer-readable storage medium, and when the computer-readable instruction is executed by a processor, the steps of the vision calibration method as described above are implemented.
[0016] Compared with the prior art, the embodiments of the present application mainly have the following beneficial effects:
[0017] The present application provides a vision calibration method, a computer device and a storage medium. By solving the actual coordinate position of the vision reference point in the robot coordinate, obtaining the coordinate conversion relationship through calibration calculation, and using the relationship between image pixels and spatial coordinate numerical equivalents, the calibration calculation time is reduced and the calibration efficiency is improved. In addition, the present application uses the corresponding coordinate relationship of the two-dimensional plane to reduce the number of camera shootings, making the calibration process of the screwdriver simple in operation, good in flexibility, short in time cycle, and easy to meet the production requirements of the screwdriver production line. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] To more clearly illustrate the solutions in the present application, the following will briefly introduce the drawings required for the description of the embodiments of the present application. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0019] Figure 1 is a schematic diagram of an embodiment of the calibration system of the present application;
[0020] Figure 2It is a schematic flowchart of an implementation manner of the visual calibration method of the present application;
[0021] Figure 3 It is a schematic flowchart of an implementation manner of step S100 of the present application;
[0022] Figure 4 It is a schematic flowchart of an implementation manner of step S110 of the present application;
[0023] Figure 5 It is a schematic flowchart of an implementation manner of step S200 of the present application;
[0024] Figure 6 It is a schematic flowchart of an implementation manner of step S300 of the present application;
[0025] Figure 7 It is a schematic flowchart of an implementation manner of step S500 of the present application;
[0026] Figure 8 It is a schematic structural diagram of a computer device according to an implementation manner of the present application. Detailed implementation manner
[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above drawings are intended to cover non-exclusive inclusion. The terms "first", "second", etc. in the specification and claims of this application or the above drawings are used to distinguish different objects and not to describe a specific order.
[0028] Referring to "embodiment" herein means that a specific feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of this application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0029] It can be understood that the visual calibration method of the present application can be applied in the field of screwing mobile phones. In a specific application scenario of the present application, the calibration method designs the commonly used screw models on the mobile phone into special tooling fixtures. The operator only needs to align the screw driver with the corresponding screw model of the tooling fixture to complete the high-precision visual screw machine calibration, greatly simplifying the calibration steps of the visual screw machine and shortening the on-site debugging time. Moreover, the present application establishes the tool coordinate system of the mobile camera center in two steps. First, the commonly used screw models on the mobile phone are designed into special tooling fixtures, and the pixel distance of the tooling fixture and the actual size of the similar model are measured to obtain the parameter ratio of the pixel to the robot coordinate. Then, during the machine teaching process, the center of the calibration circle is made equal to the center of the camera field of view, and finally, the tool coordinate system of the camera center is established. By improving the calibration method, it is possible to avoid the robot moving nine times for taking pictures, making the calibration process of the screw machine simple to operate, flexible, short in time cycle, and easy to meet the production requirements of the screw machine production line. It should be noted that the visual calibration method of the present application can also be applied in other scenarios, which will not be specifically limited here. Please refer to the following for a detailed introduction of the calibration method of the present application.
[0030] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0031] Please refer to Figure 1 , Figure 1 which is a schematic diagram of an embodiment of the calibration system of the present application. As Figure 1 The calibration system of the present application includes a calibration robot 100, a camera C, and a target workpiece G. Among them, the robot 100 includes a robotic arm 110 and an execution end H (equivalent to the screw of the present application) provided on the robotic arm 110. The camera C is provided on the robotic arm, and a plurality of screw holes are provided on the target workpiece G. Referring to Figure 1 , the prerequisite for calibration is to perform camera calibration to solve the relationship between the mechanical coordinate system and the image pixel coordinate system in space, which is the camera calibration process.
[0032] Furthermore, the coordinate systems involved in this process include the mechanical coordinate system (x H , y H , z H ), the camera coordinate system (x c , y c , z c ), and the image pixel coordinate system (x, y). The conversion between the mechanical coordinate system and the camera coordinate system is as follows:
[0033]
[0034] Among them, R is the rotation transformation matrix, and T is the translation transformation matrix.
[0035] Furthermore, the conversion between the camera coordinate system and the image coordinate system is as follows:
[0036]
[0037] S is the scale factor, and f x , f y is the value of the lens focal length in the x and y directions, γ is the deviation caused by the non-perpendicularity between the image plane and the optical axis. Δμ and Δν are the deviation values between the center of the image plane and the optical axis passing through the image plane. In the ideal state, f x = f y = f; γ = Δν = Δμ = 0.
[0038] Through the above relationships, the relationship formula between the mechanical coordinates and the image coordinates can be obtained. It can be understood that since the screwdriver is in the two-dimensional plane field, the value of z can be temporarily not considered, and the obtained formula is as follows:
[0039]
[0040] where R1 is the rotation coefficient, and the above formula can be converted to:
[0041]
[0042] According to the above formula, first, use the camera to take pictures to obtain the ratio K between the pixel size of the screw and the actual physical size of the screw, that is, the pixel equivalent. Using K, the proportional relationship between a and b can be obtained. Where a represents the actual size of the screw, and b is the pixel size of the screw. Substituting into the above formula, we can get:
[0043]
[0044] By the triangle theorem, substituting the coordinates of (x H , y H ) and (x, y) into the above formula, the corresponding rotation coefficient and displacement coefficient can be obtained through calculation.
[0045] Please refer to Figure 2 , Figure 2 which is the flowchart of an implementation manner of the vision calibration method of the present application. As Figure 1 The vision calibration method of the present application includes the following steps:
[0046] S100, obtain the pixel equivalent value of the camera.
[0047] Please further refer to Figure 3 , Figure 3 which is the flowchart of an implementation manner of step S100 of the present application. As Figure 3 The step S100 of the present application further includes the following sub-steps:
[0048] S110, correspond the robot coordinate system and the camera coordinate system.
[0049] Please refer further to Figure 4 , Figure 4 , which is a schematic flowchart of an implementation manner of step S110 of this application. As Figure 4 Step S110 of this application further includes the following sub-steps:
[0050] S111, create a second reference point within the camera's field of view.
[0051] Optionally, determine the X-axis direction and Y-axis direction of the camera coordinate system, and then a second reference point needs to be created within the camera's field of view.
[0052] S112, fix the second reference point, and move the camera along the first direction and the second direction of the robot respectively.
[0053] Optionally, in this application, the first direction can be the positive X-axis direction, and the second direction can be the positive Y-axis direction. Move the camera along the positive X-axis direction and the positive Y-axis direction of the robot respectively. Optionally, move the robot, and the camera will move along with it. Since the second reference point is fixed, only observe the pixel coordinate transformation of the second reference point in the image, then it can be determined whether the robot coordinate system and the camera coordinate system correspond.
[0054] S113, determine whether the direction change of the pixel coordinates of the second reference point is consistent with the actual movement direction of the second reference point.
[0055] Furthermore, determine whether the direction change of the pixel coordinates of the second reference point is consistent with the actual movement direction of the second reference point. If the direction change of the pixel coordinates of the second reference point is consistent with the actual movement direction of the second reference point, it indicates that the robot coordinate system and the camera coordinate system are aligned, and then enter step S120. On the contrary, if the direction change of the pixel coordinates of the second reference point is inconsistent with the actual movement direction of the second reference point, enter step S114.
[0056] S114, swap the robot coordinate system and the camera coordinate system.
[0057] It can be understood that if the direction change of the pixel coordinates of the second reference point is inconsistent with the actual movement direction of the second reference point, then swap the XY-axis coordinate system of the camera and the XY-axis coordinate system of the robot.
[0058] S120, create a first reference point within the camera's field of view.
[0059] Further, establish a first reference point under the camera's field of view. It can be understood that the first reference point in step S120 can be the same as or different from the second reference point in step S111, and no specific limitation is made here.
[0060] S130, locate the first pixel coordinates of the first reference point.
[0061] Specifically, in step S130, the first pixel coordinates of the current first reference point can be located in the direction of shape matching. The method of image matching mainly includes the following steps:
[0062] Establish an outer contour template of the first reference point, search for a match in the first image using the parameters of the outer contour template, and take the position with the highest matching score as the first pixel coordinates of the first reference point. Of course, the first pixel coordinates of the first reference point can also be obtained by fitting a circle to the outer contour edge of the first reference point to obtain the center coordinates of the point, and no specific limitation is made here.
[0063] S140, control the robot to move a preset distance in any direction.
[0064] Further, control the robot to offset a little preset distance in any direction.
[0065] S150, determine the second pixel coordinates of the first reference point after moving the preset distance.
[0066] Determine the second pixel coordinates of the offset first reference point through shape matching. The specific method is as follows:
[0067] Establish an outer contour template of the first reference point; search for a match in the second image using the parameters of the outer contour template; take the position with the highest matching score as the second pixel coordinates of the first reference point. Of course, in other embodiments, the second pixel coordinates of the first reference point can also be obtained by fitting a circle to the outer contour edge of the first reference point to obtain the center coordinates of the point, and no specific limitation is made here.
[0068] S160, obtain the pixel equivalent of the camera according to the absolute value of the difference between the first pixel coordinates and the second pixel coordinates and the preset distance moved by the robot.
[0069] For example, the first pixel coordinates of the first reference point are A, the preset distance offset by the robot is Dis, and the second pixel coordinates of the first reference point are B. Then, by dividing the preset distance Dis offset by the robot by the absolute value of the difference between the first pixel coordinates A and the second pixel coordinates B, the pixel equivalent value m_Equivalent of the camera can be obtained:
[0070] m_Equivalent = Dis / |A - B| (6)
[0071] S200. Calculate the actual distance from any reference point to the camera center according to the pixel equivalent value.
[0072] Please refer to Figure 5 , Figure 5 , which is a schematic flowchart of an embodiment of step S200 of this application. As Figure 5 Step S200 further includes the following sub-steps:
[0073] S210. Obtain the pixel coordinates of the camera center and the pixel coordinates of any reference point.
[0074] It can be understood that the pixel coordinates of the camera center O are half of the dimensions of the long side W and the short side H of the camera. Arbitrarily select a reference point in the target workpiece and obtain its pixel coordinates.
[0075] S220. Calculate the difference between the pixel coordinates of the camera center and any reference point.
[0076] Subtract the pixel coordinates of the camera center from the pixel coordinates of any reference point to obtain the difference between their pixel coordinates.
[0077] S230. Obtain the actual distance from any reference point to the camera center according to the pixel equivalent value of the camera and the difference between the pixel coordinates.
[0078] Furthermore, multiply the difference between the pixel coordinates of any reference point and the pixel coordinates of the camera center by the pixel equivalent value m_Equivalent to obtain the actual distance S from any reference point to the camera center.
[0079] S300. Obtain the actual relative distance between the camera center and the end effector of the robot.
[0080] Please refer to Figure 6 , Figure 6 , which is a schematic flowchart of an embodiment of step S300 of this application. As Figure 5 Step S300 further includes the following sub-steps:
[0081] S310. Map the camera center coordinates and the coordinates of the end effector of the robot to the same actual position.
[0082] S320. Obtain the difference between the coordinates of the camera center and the end effector of the robot.
[0083] S330. Calculate the actual relative distance between the camera center and the end effector of the robot according to the difference between the coordinates.
[0084] Specifically, a reference point is pasted under the camera's field of view. It can be understood that this reference point has nothing to do with the first reference point and the second reference point in the above text. It can be any reference point on the target workpiece (the screw hole corresponding to the screw). The mobile robot aligns the camera center with the reference point center and records the current robot coordinates. Then, the mobile robot aligns the calibration needle (the execution end of the robot) with the reference point center and records the current robot coordinates. Subtracting the machine coordinates of the calibration needle center from the machine coordinates of the camera center can obtain the distance S1 from the camera center to the execution end.
[0085] S400. Obtain the conversion relationship between the pixel coordinates of the camera and the execution end of the robot based on the actual distance from the reference point to the camera center and the distance from the camera center to the execution end of the robot.
[0086] Furthermore, based on the actual distance S0 from any reference point to the camera center and the actual relative distance S1 between the camera center and the execution end of the robot, through conversion, the conversion formula S2 = S0 + S1 between the camera pixel coordinates and the actual execution end of the robot can be obtained. The camera center can be used as the origin of the coordinate system for conversion.
[0087] S500. Obtain the position of the reference point in the robot coordinate system according to the conversion relationship.
[0088] Please refer to Figure 7 , Figure 7 which is a schematic flow diagram of an embodiment of step S500 of this application. As Figure 7 Step S500 further includes the following sub-steps:
[0089] S510. Obtain the image coordinate position of the reference point using shape matching.
[0090] Optionally, obtain the image coordinate position of the reference point using shape matching.
[0091] Furthermore, establish an outer contour template of the reference point, search and match in the image using the parameters of the outer contour template, and take the position with the highest matching score as the pixel coordinates of the reference point.
[0092] S520. Obtain the position of the reference point in the robot coordinate system according to the image coordinate position and the conversion relationship.
[0093] Furthermore, according to the image coordinate position and the conversion relationship S2 between the camera pixel coordinates and the actual execution end of the robot, the position of the reference point in the robot coordinate system can be obtained.
[0094] In a specific application scenario of this application, the machine coordinate position of the screw hole can be obtained through the conversion relationship S2. Then, move the execution end of the robot to the corresponding coordinate to align with the screw hole and perform screwing.
[0095] In the above embodiments, by solving the actual coordinate position of the visual reference point in the robot coordinates, obtaining the coordinate conversion relationship through calibration calculation, and using the image pixel relationship and the spatial coordinate numerical equivalent, the calibration calculation time is reduced and the calibration efficiency is improved. In addition, the present application uses the corresponding coordinate relationship in the two-dimensional plane to reduce the number of camera shootings, making the calibration process of the screwdriver simple in operation, good in flexibility, short in time period, and easy to meet the production requirements of the screwdriver production line.
[0096] Furthermore, through experimental comparison, it is found that the improved calibration method of the present application has a greater improvement in terms of accuracy and efficiency compared to the nine-point calibration. As shown in the following table, the average values of the data obtained through 100 repeated experiments are as follows;
[0097] Table 1 Comparison of Experimental Data
[0098] Calibration method X-axis deviation (mm) Y-axis deviation (mm) Calibration time (ms) Number of photo shootings Nine-point calibration 0.00503 0.0612 54 9 Method of this paper 0.00543 0.0565 30 3
[0099] It can be found from the above data comparison that the visual calibration method of the present application has a greater improvement in time efficiency compared to the nine-point method of Halcon, and the number of shootings is significantly reduced.
[0100] To solve the above technical problems, the embodiments of the present application also provide a computer device. For details, please refer to Figure 8 , Figure 8 which is the basic structural block diagram of the computer device in this embodiment.
[0101] The computer device 300 includes a memory 301, a processor 302, and a network interface 303 that are communicatively connected to each other through a system bus. It should be noted that Figure 8 only the computer device 300 with components 301-303 is shown in , but it should be understood that it is not required to implement all the shown components, and more or fewer components can be alternatively implemented. Among them, those skilled in the art of the present technology can understand that a computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0102] The computer device can be a computing device such as a desktop computer, a notebook, a palm computer, and a cloud server. The computer device can perform human-computer interaction with the user through a keyboard, a mouse, a remote control, a touchpad, a voice control device, or the like.
[0103] The memory 301 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disc, and the like. In some embodiments, the memory 301 may be an internal storage unit of the computer device 300, such as the hard disk or memory of the computer device 300. In other embodiments, the memory 301 may also be an external storage device of the computer device 300, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc., equipped on the computer device 300. Of course, the memory 301 may also include both the internal storage unit and the external storage device of the computer device 300. In this embodiment, the memory 301 is generally used to store the operating system and various application software installed on the computer device 300, such as computer-readable instructions for an interface call method. In addition, the memory 301 can also be used to temporarily store various data that have been output or will be output.
[0104] In some embodiments, the processor 302 can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 302 is generally used to control the overall operation of the computer device 300. In this embodiment, the processor 302 is used to run the computer-readable instructions stored in the memory 301 or process data, such as running computer-readable instructions for a vision calibration method.
[0105] The network interface 303 may include a wireless network interface or a wired network interface, and the network interface 303 is generally used to establish a communication connection between the computer device 300 and other electronic devices.
[0106] In the above embodiments, by solving the actual coordinate position of the visual reference point in the robot coordinate system, obtaining the coordinate conversion relationship through calibration calculation, and using the relationship between image pixels and spatial coordinate numerical equivalents, the calibration calculation time is reduced and the calibration efficiency is improved. In addition, the present application uses the corresponding coordinate relationship in the two-dimensional plane to reduce the number of camera shootings, making the calibration process of the screwdriver simple in operation, good in flexibility, short in time period, and easy to meet the production requirements of the screwdriver production line.
[0107] The present application also provides another embodiment, that is, to provide a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to execute the steps of the visual calibration method as described above.
[0108] In the above embodiments, by solving the actual coordinate position of the visual reference point in the robot coordinate system, obtaining the coordinate conversion relationship through calibration calculation, and using the relationship between image pixels and spatial coordinate numerical equivalents, the calibration calculation time is reduced and the calibration efficiency is improved. In addition, the present application uses the corresponding coordinate relationship in the two-dimensional plane to reduce the number of camera shootings, making the calibration process of the screwdriver simple in operation, good in flexibility, short in time period, and easy to meet the production requirements of the screwdriver production line.
[0109] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of the various embodiments of the present application.
[0110] Obviously, the above-described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The accompanying drawings show the preferred embodiments of the present application, but do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosed content of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, for those skilled in the art, they can still modify the technical solutions described in the foregoing specific embodiments, or perform equivalent replacements on some of the technical features. Any equivalent structure directly or indirectly using the content of the specification and drawings of the present application in other related technical fields is equally within the scope of the patent protection of the present application.
Claims
1. A visual calibration method, characterized in that, The calibration method includes: Obtaining the pixel equivalent value of the camera, including: Corresponding the robot coordinate system and the camera coordinate system; Creating a first reference point under the camera's field of view; Locating the first pixel coordinates of the first reference point, including: establishing an outer contour template of the first reference point; searching and matching in the first image using the parameters of the outer contour template; taking the position with the highest matching score as the first pixel coordinates of the first reference point; Controlling the robot to move a preset distance in an arbitrary direction; determining the second pixel coordinates of the first reference point after moving the preset distance; obtaining the pixel equivalent of the camera based on the absolute value of the difference between the first pixel coordinates and the second pixel coordinates and the preset distance moved by the robot; Calculating the actual distance from any reference point to the camera center according to the pixel equivalent value; Obtaining the actual relative distance between the camera center and the robot's execution end; Obtaining the conversion relationship between the pixel coordinates of the camera and the robot's execution end based on the actual distance from the reference point to the camera center and the distance of the camera center relative to the robot's execution end; Obtaining the position of the reference point in the robot coordinate system according to the conversion relationship.
2. The calibration method according to claim 1, characterized in that, The determining of the second pixel coordinates of the first reference point after moving the preset distance further includes: Establishing an outer contour template of the first reference point; Searching and matching in the second image using the parameters of the outer contour template; Taking the position with the highest matching score as the second pixel coordinates of the first reference point.
3. The calibration method according to claim 1, characterized in that, The corresponding of the robot coordinate system and the camera coordinate system further includes: Creating a second reference point under the camera's field of view; Fixing the second reference point and moving the camera along the first direction and the second direction of the robot respectively; Judging whether the direction change of the pixel coordinates of the second reference point is consistent with the actual moving direction of the second reference point; If the judgment is no, then swapping the robot coordinate system and the camera coordinate system.
4. The calibration method according to claim 1, characterized in that, The calculating of the actual distance from any reference point to the camera center according to the pixel equivalent value further includes: Obtaining the pixel coordinates of the camera center and the pixel coordinates of any reference point; Calculating the difference between the pixel coordinates of the camera center and any reference point; Obtaining the actual distance from any reference point to the camera center according to the pixel equivalent value of the camera and the difference between the pixel coordinates.
5. The calibration method according to claim 1, characterized in that, The obtaining of the actual relative distance between the camera center and the robot's execution end further includes: Mapping the coordinates of the camera center and the coordinates of the robot's execution end to the same actual position; Obtaining the coordinate difference between the camera center and the robot's execution end; Calculating the actual relative distance between the camera center and the robot's execution end according to the coordinate difference.
6. The calibration method according to claim 1, characterized in that, The obtaining of the position of the reference point in the robot coordinate system according to the conversion relationship further includes: Obtaining the image coordinate position of the reference point using shape matching; Obtaining the position of the reference point in the robot coordinate system according to the image coordinate position and the conversion relationship.
7. A computer device, characterized in that, It includes a memory and a processor. Computer-readable instructions are stored in the memory. When the processor executes the computer-readable instructions, the steps of the visual calibration method according to any one of claims 1 to 6 are implemented.
8. A computer-readable storage medium, characterized in that, Computer-readable instructions are stored on the computer-readable storage medium. When the computer-readable instructions are executed by a processor, the steps of the visual calibration method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Bag making machine positioning system based on machine vision and cutting method
CN111376531A