Calibration method and device for camera in dispensing system and readable storage medium

The camera captures the calibration plate and obtains the hole position, calculates the conversion matrix of the camera and the glue gun, and realizes the calibration of the camera, solving the problem of inaccurate positioning of the glue gun in the dispensing system, improving the dispensing accuracy and product qualification rate.

CN119107370APending Publication Date: 2024-12-10北歌(潍坊)智能科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411034857.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

In the dispensing system, it is difficult to achieve accurate positioning during the camera calibration process, resulting in inaccurate dispensing position of the glue gun on the product, affecting the product's pass rate.

Method used

By controlling the camera to take pictures of the calibration plate, the position of the holes in the camera and glue gun coordinate system is obtained, the conversion matrix between the camera coordinate system and the glue gun coordinate system is calculated, and the camera calibration is realized, so as to accurately control the glue gun dispensing treatment of the product .

Benefits of technology

Improves the glue dispensing accuracy and product pass rate, simplifies the calibration process after glue gun replacement, and reduces downtime and calibration complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119107370A_ABST
    Figure CN119107370A_ABST
Patent Text Reader

Abstract

The invention discloses a calibration method and device for a camera in a dispensing system and a readable storage medium, and the method comprises the steps: controlling the camera to shoot a calibration plate placed at a set position of the dispensing system, and obtaining a calibration image; the calibration plate comprises a plurality of holes; according to the calibration image, obtaining a pixel position of the hole in a camera coordinate system of the camera; controlling a glue gun of the glue dispensing system to move to the position of the hole, acquiring the position of a glue head in a glue gun coordinate system of the glue gun when the glue head of the glue gun is inserted into the hole, and taking the position as the mechanical position of the hole in the glue gun coordinate system; and obtaining a first conversion matrix from the camera coordinate system to the glue gun coordinate system according to the pixel position of the hole and the mechanical position, and realizing calibration of the camera.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic equipment, and more specifically, the present invention relates to a calibration method for a camera in a dispensing system, a calibration device for a camera in a dispensing system, and a computer-readable storage medium. Background Art

[0002] Visual positioning technology uses a camera to take a picture of the object to be positioned, and then positions the object based on the image. In guided gluing applications, visual positioning technology is usually used to guide the glue gun to glue the product.

[0003] In order to ensure the accuracy of the dispensing position, the camera needs to be calibrated before dispensing. Summary of the invention

[0004] An object of an embodiment of the present invention is to provide a calibration method, device and readable storage medium for a camera in a dispensing system.

[0005] According to a first aspect of the present disclosure, a method for calibrating a camera in a dispensing system is provided, comprising:

[0006] Controlling the camera to photograph a calibration plate placed at a set position of the dispensing system to obtain a calibration image; the calibration plate includes a plurality of holes;

[0007] According to the calibration image, a pixel position of the hole in a camera coordinate system of the camera is obtained;

[0008] Control the glue gun of the glue dispensing system to move to the position of the hole, and obtain the position of the glue head of the glue gun in the glue gun coordinate system when the glue head of the glue gun is inserted into the hole, as the mechanical position of the hole in the glue gun coordinate system;

[0009] According to the pixel position of the hole and the mechanical position, a first conversion matrix from the camera coordinate system to the glue gun coordinate system is obtained to achieve calibration of the camera.

[0010] Optionally, obtaining the pixel position of the hole in the camera coordinate system of the camera according to the calibration image includes:

[0011] Extracting a target object representing a hole in the calibration image according to the geometric shape features of the hole;

[0012] The pixel position of the hole is determined according to the position of the target object in the calibration image.

[0013] Optionally, the method further includes:

[0014] Obtaining a calibration position of the hole in a calibration plate coordinate system of the calibration plate;

[0015] According to the calibrated position of the hole, verifying the corresponding pixel position;

[0016] Eliminate pixel locations that fail validation.

[0017] Optionally, the verifying the corresponding pixel position according to the calibrated position of the hole includes:

[0018] Obtain a second transformation matrix from the camera coordinate system to the calibration plate coordinate system;

[0019] Matching the calibrated position of the hole with the pixel position to obtain a pixel position corresponding to the calibrated position;

[0020] Obtaining a projection error of the hole corresponding to the calibration position according to the calibration position, a pixel position corresponding to the calibration position, and the second transformation matrix, wherein the projection error represents an error between the calibration position and a projection position in the calibration coordinate system according to the corresponding pixel position;

[0021] The corresponding pixel position is verified according to the projection error.

[0022] Optionally, verifying the corresponding pixel position according to the projection error includes:

[0023] It is determined that the pixel position verification of the hole whose corresponding projection error is greater than or equal to the set threshold fails.

[0024] Optionally, the method further includes:

[0025] Obtaining a calibration position of the hole in a calibration plate coordinate system of the calibration plate;

[0026] Matching the calibrated position of the hole with the pixel position to obtain a pixel position corresponding to the calibrated position;

[0027] According to the calibrated position of the hole, the corresponding pixel position is optimized.

[0028] Optionally, the optimizing the corresponding pixel position according to the calibrated position of the hole includes:

[0029] Obtain a second transformation matrix from the camera coordinate system to the calibration plate coordinate system;

[0030] According to the second transformation matrix and the calibration position, the corresponding pixel position is optimized so that the projection error of the hole at the calibration position is minimized, and the projection error represents the error between the calibration position of the corresponding hole and the projection position in the calibration coordinate system according to the corresponding pixel position.

[0031] Optionally, before obtaining the pixel position of the hole in the camera coordinate system of the camera according to the calibration image, the method further includes:

[0032] The calibration image is preprocessed, wherein the preprocessing includes any one or more of image denoising, image filtering, and image downsampling.

[0033] According to a second aspect of the present disclosure, a calibration device for a camera in a dispensing system is provided, comprising:

[0034] A shooting control module, used to control the camera to shoot a calibration plate placed at a set position of the dispensing system to obtain a calibration image; the calibration plate includes a plurality of holes;

[0035] A pixel position determination module, used to obtain the pixel position of the hole in the camera coordinate system of the camera according to the calibration image;

[0036] A mechanical position determination module, used for controlling the glue gun of the glue dispensing system to move to the position of the hole, and obtaining the position of the glue head of the glue gun in the glue gun coordinate system when the glue head of the glue gun is inserted into the hole as the mechanical position of the hole in the glue gun coordinate system;

[0037] The camera calibration module is used to obtain a first conversion matrix from the camera coordinate system to the glue gun coordinate system according to the pixel position of the hole and the mechanical position, so as to realize the calibration of the camera.

[0038] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in the first aspect of the present disclosure is implemented.

[0039] Through the embodiments of the present disclosure, the pixel position of the hole in the calibration plate in the camera coordinate system is determined according to the calibration image obtained by photographing the calibration plate placed at the set position of the dispensing system by the camera; the glue gun of the dispensing system is controlled to move to the position of the hole, and the position of the glue head of the glue gun in the glue gun coordinate system when the glue head is inserted into the hole is obtained as the mechanical position of the hole in the glue gun coordinate system; according to the pixel position and mechanical position of the hole, a first conversion matrix from the camera coordinate system to the glue gun coordinate system is obtained, and the camera calibration can be realized, so that according to the subsequent image obtained by the camera shooting the product to be dispensed and the first conversion matrix, the glue gun can be controlled to accurately dispense the product to be dispensed, thereby improving the qualified rate of dispensing precision products.

[0040] Further features and advantages of the present invention will become apparent from the following detailed description of exemplary embodiments of the present invention with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.

[0042] Figure 1 is a schematic structural diagram of a dispensing system provided according to an embodiment of the present disclosure;

[0043] Figure 2 is a flow chart of a camera calibration method in a dispensing system provided according to an embodiment of the present disclosure;

[0044] Figure 3 is a flowchart of an example of a calibration method for a camera in a dispensing system provided according to an embodiment of the present disclosure;

[0045] Figure 4 It is a block diagram of a camera calibration device in a dispensing system provided according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0046] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.

[0047] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.

[0048] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.

[0049] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0050] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0051] This embodiment provides a dispensing system, such as Figure 1 As shown, the dispensing system 100 may include at least one camera 110 and a glue gun 120 .

[0052] In this embodiment, the camera 110 may be fixed on a bracket, and the position of the camera 110 will not change during the calibration and dispensing process.

[0053] During the use of the dispensing system 100 , if the glue gun 120 is replaced, the camera needs to be calibrated.

[0054] This embodiment provides a calibration method for a camera in a dispensing system. The calibration method for a camera in a dispensing system can be implemented by the dispensing system.

[0055] Figure 2 It is a flow chart of a method for calibrating a camera in a dispensing system provided according to an embodiment of the present disclosure.

[0056] like Figure 2 As shown, the calibration method of the camera in the dispensing system may include steps S2100 to S2400 as shown below:

[0057] Step S2100, controlling the camera to photograph a calibration plate placed at a set position of the dispensing system to obtain a calibration image; the calibration plate includes a plurality of holes.

[0058] When the dispensing system includes multiple cameras, the set position is within the common field of view of the multiple cameras, that is, each camera can completely capture the calibration plate placed at the set position.

[0059] The calibration plate may include a plurality of circular holes, the diameter of the holes allowing the glue head of the glue gun to be inserted through, and the plurality of holes are arranged in an array on the calibration plate.

[0060] In one embodiment of the present disclosure, after obtaining the calibration image and before executing step S2200, the method may further include: preprocessing the calibration image, where the preprocessing includes any one or more of image denoising, image filtering, and image downsampling.

[0061] Image denoising refers to the process of reducing noise in digital images.

[0062] Image filtering, that is, suppressing the noise of the target image while retaining the image details as much as possible, is an indispensable operation in image preprocessing. The quality of its processing will directly affect the effectiveness and reliability of subsequent image processing and analysis.

[0063] Image downsampling is to reduce the size of the image, which can reduce the amount of processing operations.

[0064] Through this embodiment, the calibration image is preprocessed, which can improve the accuracy and efficiency of subsequent determination of pixel positions, thereby improving the accuracy of the camera calibration result and the camera calibration efficiency.

[0065] Step S2200: Obtain the pixel position of the hole in the camera coordinate system of the camera according to the calibration image.

[0066] In this embodiment, the hole in the calibration image may be identified first, and then the position of the center of the identified hole in the calibration image may be determined as the pixel position of the hole in the camera coordinate system.

[0067] In one embodiment of the present disclosure, obtaining the pixel position of the hole in the camera coordinate system of the camera according to the calibration image may include the following steps S2210 to S2220:

[0068] Step S2210: extracting a target object representing a hole in the calibration image according to the geometric shape features of the hole.

[0069] In this embodiment, the geometric shape of the hole is a circle, and the diameter of the hole in the calibration image is a set pixel value. Then, according to the geometric shape characteristics of the hole, the target object representing the hole in the calibration image is extracted, and the object in the calibration image that is a circle and has a diameter close to the diameter of the hole in the calibration image is extracted as the target object.

[0070] Step S2220, determining the pixel position of the hole according to the position of the target object in the calibration image.

[0071] In this embodiment, the position of the center of the target object in the calibration image may be used as the pixel position of the hole.

[0072] In the embodiment where the geometric shape of the hole is circular, the target object is also circular, and the center of the target object represents the center of the corresponding hole.

[0073] In one example, based on the geometric shape features of the hole, not only the target object representing the hole in the calibration image can be extracted, but also other target objects in the calibration image that are close to the shape and diameter of the hole may be extracted. In addition, the pixel position of the obtained hole may also be wrong or biased. In order to improve the accuracy of the camera calibration result, each pixel position can be verified and the pixel position that failed the verification can be eliminated. Among them, the pixel position that failed the verification may not be the pixel position of the hole in the calibration plate.

[0074] In one embodiment of the present disclosure, based on obtaining the pixel position of the hole, the method may also include: obtaining the calibration position of the hole in the calibration plate coordinate system of the calibration plate; verifying the corresponding pixel position according to the calibration position of the hole, and eliminating the pixel position that fails the verification.

[0075] In this embodiment, the calibration position of the hole in the calibration plate coordinate system of the calibration plate may be pre-calibrated in the calibration plate and stored in the calibration device of this embodiment. The calibration plate coordinate system may be a plane rectangular coordinate system constructed based on the calibration plate, the origin of the calibration plate coordinate system may be any position in the calibration plate, and both coordinate axes of the calibration plate coordinate system are parallel to the calibration plate.

[0076] In one embodiment of the present disclosure, verifying the corresponding pixel position according to the calibrated position of the hole may include: determining the pixel position corresponding to each calibrated position according to the relative position relationship between the calibrated positions and the relative position relationship between the pixel positions. The hole corresponding to any calibrated position is the same as the hole represented by the pixel position corresponding to the calibrated position.

[0077] In one embodiment of the present disclosure, verifying the corresponding pixel position according to the calibrated position of the hole may include: acquiring a second transformation matrix from the camera coordinate system to the calibration plate coordinate system; matching the calibrated position of the hole with the pixel position to obtain the pixel position corresponding to the calibrated position; obtaining the projection error of the hole corresponding to the calibrated position according to the calibrated position, the pixel position corresponding to the calibrated position, and the second transformation matrix, wherein the projection error represents the error between the calibrated position and the projection position of the corresponding pixel position in the calibrated coordinate system; and verifying the corresponding pixel position according to the projection error.

[0078] The projection error in this embodiment can measure the matching accuracy between the calibrated position and the corresponding pixel position.

[0079] In one embodiment, the projection error may represent the distance between the calibration position and the projection position of the corresponding pixel position in the calibration coordinate system. For example, if the calibration position is (X1, Y1) and the corresponding projection position is (X2, Y2), then the projection error may be

[0080]

[0081] In another embodiment, the projection error may represent the difference between the calibration position and the corresponding projection position on each coordinate axis of the calibration coordinate system. For example, if the calibration position is (X1, Y1) and the corresponding projection position is (X2, Y2), then the projection error may be (X1-X2, Y1-Y2).

[0082] In one embodiment, for each pixel position, the projection position of the pixel position in the calibration coordinate system is obtained according to the second transformation matrix, and then the error of the projection position relative to the calibration position corresponding to the pixel position is determined as the projection error of the corresponding hole.

[0083] In another embodiment, according to the preset ordering of the holes, a pixel position matrix is ​​constructed according to the pixel positions of all the holes, and a calibration position matrix is ​​constructed according to the calibrated positions of all the holes, and elements at the same position in the pixel position matrix and the calibration position matrix correspond to the same hole.

[0084] On this basis, according to the pixel position matrix and the second conversion matrix, a projection position matrix representing the projection positions of all holes is obtained; the elements at the same position in the projection position matrix and the calibration position matrix correspond to the same hole. Then, according to the difference between the projection position matrix and the calibration position matrix, a projection error matrix is ​​obtained, and the elements at the same position in the projection error matrix and the calibration position matrix correspond to the same hole. In addition, in the embodiment where the projection error represents the difference between the calibration position and the corresponding projection position on each coordinate axis of the calibration coordinate system, the elements at the same position in the projection error matrix and the calibration position matrix correspond to the same coordinate axis in the calibration coordinate system.

[0085] In one embodiment of the present disclosure, the corresponding pixel position is verified according to the projection error: it is determined that the verification of the pixel position of the hole whose corresponding projection error is greater than or equal to a set threshold fails.

[0086] In an embodiment where the projection error represents the distance between the calibration position and the projection position according to the corresponding pixel position in the calibration coordinate system, it may be that the pixel position verification of a hole whose projection error is greater than or equal to a set threshold fails, and the pixel position verification of a hole whose projection error is less than the set threshold succeeds.

[0087] In an embodiment where the projection error represents the difference between the calibration position and the corresponding projection position on each coordinate axis of the calibration coordinate system, it may be that when the difference between the calibration position and the corresponding projection position on at least one coordinate axis of the calibration coordinate system is greater than or equal to a set threshold, it is determined that the verification of the pixel position of the corresponding hole has failed; and when the difference between the calibration position and the corresponding projection position on each coordinate axis of the calibration coordinate system is less than the set threshold, it is determined that the verification of the pixel position of the corresponding hole has succeeded.

[0088] In the case where the pixel position verification of any hole fails, it means that the target object obtained for the pixel position is unreliable or wrong and cannot represent the hole in the calibration plate.

[0089] Through this embodiment, the pixel positions that fail verification are eliminated, so that the accuracy of the obtained pixel positions can be improved, and thus the accuracy of the camera calibration result can be improved.

[0090] In one embodiment of the present disclosure, the method may further include: optimizing the corresponding pixel position according to the calibrated position of the hole.

[0091] In one embodiment of the present disclosure, optimizing the corresponding pixel position according to the calibrated position of the hole may include: optimizing the corresponding pixel position according to the second transformation matrix and the calibrated position so that the projection error of the hole at the calibrated position is minimized.

[0092] In one embodiment, according to the preset ordering of the holes, a pixel position matrix is ​​constructed according to the pixel positions of all the holes, and a calibration position matrix is ​​constructed according to the calibrated positions of all the holes, and elements at the same position in the pixel position matrix and the calibration position matrix correspond to the same hole.

[0093] On this basis, according to the pixel position matrix and the second conversion matrix, a projection position matrix representing the projection positions of all holes is obtained; the elements at the same position in the projection position matrix and the calibration position matrix correspond to the same hole. Then, according to the difference between the projection position matrix and the calibration position matrix, a projection error matrix is ​​obtained, and the elements at the same position in the projection error matrix and the calibration position matrix correspond to the same hole. In addition, in the embodiment where the projection error represents the difference between the calibration position and the corresponding projection position on each coordinate axis of the calibration coordinate system, the elements at the same position in the projection error matrix and the calibration position matrix correspond to the same coordinate axis in the calibration coordinate system.

[0094] Further, the pixel positions can be optimized by first determining the sum of the pixel position matrix and the setting matrix to obtain an optimized pixel position matrix, and then obtaining a projection position matrix representing the projection positions of all holes based on the pixel position matrix and the second conversion matrix; and then obtaining a projection error matrix based on the difference between the projection position matrix and the calibration position matrix, wherein the setting matrix and the pixel position matrix have the same size.

[0095] In this embodiment, the values ​​of the elements corresponding to the holes in the setting matrix may be the same or different, which is not limited here.

[0096] Furthermore, the least squares method or other optimization algorithms may be used to calculate the set matrix corresponding to the time when the sum of all elements of the projection error matrix is ​​minimized, and then the pixel position matrix may be optimized according to the set matrix corresponding to the time when the sum of all elements of the projection error matrix is ​​minimized to obtain an optimized pixel position matrix.

[0097] In another embodiment, each pixel position may be optimized first to obtain an optimized pixel position; then the projection position of the optimized pixel position in the calibration coordinate system is obtained according to the second transformation matrix, and then the error of the projection position relative to the calibration position corresponding to the pixel position is determined as the projection error of the corresponding hole.

[0098] In this embodiment, a pixel position is optimized by summing the pixel position and the set pixel coordinates to obtain the optimized pixel position. The set pixel coordinates corresponding to different pixel positions may be the same or different, which is not limited here.

[0099] Furthermore, the least squares method or other optimization algorithms may be used to calculate the set pixel corresponding to the minimum sum of the projection errors of all holes, and then the corresponding pixel position may be optimized according to the set pixel corresponding to the minimum sum of the projection errors of all holes to obtain the optimized pixel position.

[0100] Through this embodiment, the corresponding pixel position is optimized according to the calibrated position of the hole, so that the accuracy of the obtained pixel position can be improved, and then the accuracy of the camera calibration result can be improved.

[0101] Step S2300, control the glue gun of the glue dispensing system to move to the position of the hole, obtain the position of the glue head of the glue gun in the glue gun coordinate system when the glue head of the glue gun is inserted into the hole, and use it as the mechanical position of the hole in the glue gun coordinate system.

[0102] In this embodiment, the glue gun can be controlled to move to the position of each hole of the calibration plate in turn, the glue head of the glue gun is inserted into the corresponding hole, and the position of the glue head of the glue gun in the glue gun coordinate system when the glue gun is at the position of each hole is recorded as the mechanical position of the corresponding hole in the glue gun coordinate system.

[0103] In an embodiment of the present disclosure, step S2100 may be executed first and then step S2300; or step S2300 may be executed first and then step S2100. This embodiment does not limit the execution order of step S2100 and step S2300.

[0104] Step S2400, obtaining a first conversion matrix from the camera coordinate system to the glue gun coordinate system according to the pixel position and the mechanical position of the hole, so as to realize the calibration of the camera.

[0105] Through the embodiments of the present disclosure, the pixel position of the hole in the calibration plate in the camera coordinate system is determined according to the calibration image obtained by photographing the calibration plate placed at the set position of the dispensing system by the camera; the glue gun of the dispensing system is controlled to move to the position of the hole, and the position of the glue head of the glue gun in the glue gun coordinate system when the glue head is inserted into the hole is obtained as the mechanical position of the hole in the glue gun coordinate system; according to the pixel position and mechanical position of the hole, a first conversion matrix from the camera coordinate system to the glue gun coordinate system is obtained, and the camera calibration can be realized, so that according to the subsequent image obtained by the camera shooting the product to be dispensed and the first conversion matrix, the glue gun can be controlled to accurately dispense the product to be dispensed, thereby improving the qualified rate of dispensing precision products.

[0106] In addition, the calibration process of this embodiment is simple and convenient. After replacing the glue gun of the dispensing system, the calibration method of this embodiment is executed to calibrate the camera, which can reduce the downtime of the dispensing system and reduce the complexity and time cost of calibration.

[0107] Figure 3 It is a flowchart of an example of a method for calibrating a camera in a dispensing system provided according to an embodiment of the present disclosure.

[0108] like Figure 3 As shown, the calibration method of the camera in the dispensing system may include the following steps:

[0109] Step S3001, controlling the camera to photograph a calibration plate placed at a set position of the dispensing system to obtain a calibration image; the calibration plate includes a plurality of holes.

[0110] Step S3002: extracting a target object representing a hole in the calibration image according to the geometric shape features of the hole.

[0111] Step S3003, determining the pixel position of the hole according to the position of the target object in the calibration image.

[0112] Step S3004, obtaining the calibration position of the hole in the calibration plate coordinate system of the calibration plate and a second transformation matrix from the camera coordinate system to the calibration plate coordinate system.

[0113] Step S3005, matching the calibrated position of the hole with the pixel position to obtain the pixel position corresponding to the calibrated position.

[0114] Step S3006, obtaining the projection error of the hole corresponding to the calibrated position according to the calibrated position, the pixel position corresponding to the calibrated position, and the second transformation matrix, wherein the projection error represents the error between the calibrated position and the projection position according to the corresponding pixel position in the calibrated coordinate system.

[0115] Step S3007, verifying the corresponding pixel position according to the projection error.

[0116] Step S3008, eliminating pixel positions that fail verification.

[0117] Step S3009, optimizing the corresponding pixel position according to the second conversion matrix and the calibration position so as to minimize the projection error of the hole at the calibration position.

[0118] Step S3010, controlling the glue gun of the glue dispensing system to move to the position of the hole, obtaining the position of the glue head of the glue gun in the glue gun coordinate system when the glue head of the glue gun is inserted into the hole, as the mechanical position of the hole in the glue gun coordinate system.

[0119] Step S3011, according to the pixel position and mechanical position of the hole, a first conversion matrix from the camera coordinate system to the glue gun coordinate system is obtained to realize camera calibration.

[0120] This embodiment also provides a camera calibration device in a dispensing system, such as Figure 4 As shown, the camera calibration device 4000 in the dispensing system may include a shooting control module 4100, a pixel position determination module 4200, a mechanical position determination module 4300 and a camera calibration module 4400.

[0121] The shooting control module 4100 is used to control the camera to shoot a calibration plate placed at a set position of the dispensing system to obtain a calibration image; the calibration plate includes a plurality of holes.

[0122] The pixel position determination module 4200 is used to obtain the pixel position of the hole in the camera coordinate system of the camera according to the calibration image.

[0123] The mechanical position determination module 4300 is used to control the glue gun of the dispensing system to move to the position of the hole, and obtain the position of the glue head of the glue gun in the glue gun coordinate system when the glue head of the glue gun is inserted into the hole, as the mechanical position of the hole in the glue gun coordinate system.

[0124] The camera calibration module 4400 is used to obtain a first conversion matrix from the camera coordinate system to the glue gun coordinate system according to the pixel position of the hole and the mechanical position, so as to realize the calibration of the camera.

[0125] In one embodiment of the present disclosure, the pixel position determination module 4200 is used to:

[0126] Extracting a target object representing a hole in the calibration image according to the geometric shape features of the hole;

[0127] The pixel position of the hole is determined according to the position of the target object in the calibration image.

[0128] In one embodiment of the present disclosure, the camera calibration device 4000 in the dispensing system further includes:

[0129] A module for obtaining a calibration position of the hole in a calibration plate coordinate system of the calibration plate;

[0130] A module for verifying the corresponding pixel position according to the calibrated position of the hole;

[0131] Module for culling pixel locations that fail validation.

[0132] In one embodiment of the present disclosure, the verifying of the corresponding pixel position according to the calibrated position of the hole includes:

[0133] Obtain a second transformation matrix from the camera coordinate system to the calibration plate coordinate system;

[0134] Matching the calibrated position of the hole with the pixel position to obtain a pixel position corresponding to the calibrated position;

[0135] Obtaining a projection error of the hole corresponding to the calibration position according to the calibration position, a pixel position corresponding to the calibration position, and the second transformation matrix, wherein the projection error represents an error between the calibration position and a projection position in the calibration coordinate system according to the corresponding pixel position;

[0136] The corresponding pixel position is verified according to the projection error.

[0137] In one embodiment of the present disclosure, verifying the corresponding pixel position according to the projection error includes:

[0138] It is determined that the pixel position verification of the hole whose corresponding projection error is greater than or equal to the set threshold fails.

[0139] In one embodiment of the present disclosure, the camera calibration device 4000 in the dispensing system further includes:

[0140] A module for obtaining a calibration position of the hole in a calibration plate coordinate system of the calibration plate;

[0141] A module for matching the calibrated position of the hole with the pixel position to obtain a pixel position corresponding to the calibrated position;

[0142] A module for optimizing corresponding pixel positions according to the calibrated positions of the holes.

[0143] In one embodiment of the present disclosure, the optimizing the corresponding pixel position according to the calibrated position of the hole includes:

[0144] Obtain a second transformation matrix from the camera coordinate system to the calibration plate coordinate system;

[0145] According to the second transformation matrix and the calibration position, the corresponding pixel position is optimized so that the projection error of the hole at the calibration position is minimized, and the projection error represents the error between the calibration position of the corresponding hole and the projection position in the calibration coordinate system according to the corresponding pixel position.

[0146] In one embodiment of the present disclosure, the camera calibration device 4000 in the dispensing system further includes:

[0147] A module for preprocessing the calibration image, wherein the preprocessing includes any one or more of image denoising, image filtering, and image downsampling.

[0148] This embodiment further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method described in any embodiment of the present disclosure is implemented.

[0149] The above embodiments mainly focus on describing the differences from other embodiments, but it should be clear to those skilled in the art that the above embodiments can be used alone or in combination with each other as needed.

[0150] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments, but it should be clear to those skilled in the art that the above embodiments can be used alone or in combination with each other as needed. In addition, for the device embodiment, since it corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the corresponding part of the method embodiment. The system embodiment described above is merely illustrative, and the modules described as separate components may or may not be physically separated.

[0151] The present invention may be an apparatus, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present invention.

[0152] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical compression device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.

[0153] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0154] The computer program instructions for performing the operation of the present invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present invention.

[0155] Various aspects of the present invention are described herein with reference to the flow charts and / or block diagrams of the methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each box of the flow chart and / or block diagram and the combination of each box in the flow chart and / or block diagram can be implemented by computer-readable program instructions.

[0156] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0157] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0158] The flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of an instruction, and the module, a program segment or a part of an instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.

[0159] Embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the marketplace, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein. The scope of the present invention is defined by the appended claims.

Claims

1. A method for calibrating a camera in a dispensing system, characterized in that: include: Controlling the camera to photograph a calibration plate placed at a set position of the dispensing system to obtain a calibration image; the calibration plate includes a plurality of holes; According to the calibration image, a pixel position of the hole in a camera coordinate system of the camera is obtained; Control the glue gun of the glue dispensing system to move to the position of the hole, and obtain the position of the glue head of the glue gun in the glue gun coordinate system when the glue head of the glue gun is inserted into the hole, as the mechanical position of the hole in the glue gun coordinate system; According to the pixel position of the hole and the mechanical position, a first conversion matrix from the camera coordinate system to the glue gun coordinate system is obtained to achieve calibration of the camera.

2. The method according to claim 1, characterized in that The step of obtaining the pixel position of the hole in the camera coordinate system of the camera according to the calibration image includes: Extracting a target object representing a hole in the calibration image according to the geometric shape features of the hole; The pixel position of the hole is determined according to the position of the target object in the calibration image.

3. The method according to claim 2, characterized in that The method further comprises: Obtaining a calibration position of the hole in a calibration plate coordinate system of the calibration plate; According to the calibrated position of the hole, verifying the corresponding pixel position; Eliminate pixel locations that fail validation.

4. The method according to claim 3, characterized in that The verifying the corresponding pixel position according to the calibrated position of the hole includes: Obtain a second transformation matrix from the camera coordinate system to the calibration plate coordinate system; Matching the calibrated position of the hole with the pixel position to obtain a pixel position corresponding to the calibrated position; Obtaining a projection error of the hole corresponding to the calibration position according to the calibration position, a pixel position corresponding to the calibration position, and the second transformation matrix, wherein the projection error represents an error between the calibration position and a projection position in the calibration coordinate system according to the corresponding pixel position; The corresponding pixel position is verified according to the projection error.

5. The method according to claim 4, characterized in that The verifying the corresponding pixel position according to the projection error includes: It is determined that the pixel position verification of the hole whose corresponding projection error is greater than or equal to the set threshold fails.

6. The method according to claim 2, characterized in that The method further comprises: Obtaining a calibration position of the hole in a calibration plate coordinate system of the calibration plate; Matching the calibrated position of the hole with the pixel position to obtain a pixel position corresponding to the calibrated position; According to the calibrated position of the hole, the corresponding pixel position is optimized.

7. The method according to claim 6, characterized in that The optimizing the corresponding pixel position according to the calibrated position of the hole includes: Obtain a second transformation matrix from the camera coordinate system to the calibration plate coordinate system; According to the second transformation matrix and the calibration position, the corresponding pixel position is optimized so that the projection error of the hole at the calibration position is minimized, and the projection error represents the error between the calibration position of the corresponding hole and the projection position in the calibration coordinate system according to the corresponding pixel position.

8. The method according to claim 2, characterized in that: Before obtaining the pixel position of the hole in the camera coordinate system of the camera according to the calibration image, the method further includes: The calibration image is preprocessed, wherein the preprocessing includes any one or more of image denoising, image filtering, and image downsampling.

9. A camera calibration device in a dispensing system, characterized in that: include: A shooting control module, used to control the camera to shoot a calibration plate placed at a set position of the dispensing system to obtain a calibration image; the calibration plate includes a plurality of holes; A pixel position determination module, used to obtain the pixel position of the hole in the camera coordinate system of the camera according to the calibration image; A mechanical position determination module, used for controlling the glue gun of the glue dispensing system to move to the position of the hole, and obtaining the position of the glue head of the glue gun in the glue gun coordinate system when the glue head of the glue gun is inserted into the hole as the mechanical position of the hole in the glue gun coordinate system; The camera calibration module is used to obtain a first conversion matrix from the camera coordinate system to the glue gun coordinate system according to the pixel position of the hole and the mechanical position, so as to realize the calibration of the camera.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.