Camera calibration method, device, computing device and readable storage medium

By generating a second image containing checkerboard and non-checkerboard areas, and calculating the covariance matrix and corner point correlation values, rapid calibration of the internal parameters of the RGB camera is achieved, solving the problems of long operation time and high cost in the existing technology. Suitable for industrial production.

CN112927301BActive Publication Date: 2024-09-13SHEN ZHEN 3IROBOTICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110155790.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-04
Publication Date
2024-09-13
Estimated Expiration
2041-02-04

AI Technical Summary

Technical Problem

The existing RGB camera internal parameter calibration method requires continuous shooting of at least 20 checkerboard pictures at different angles and distances. The operation time is long and the cost is high, making it difficult to apply in industrial production.

Method used

By acquiring an image containing multiple checkerboards, generating multiple second images, each second image contains checkerboard areas and non-checkerboard areas, and calculating the covariance matrix and corner point correlation values ​​to determine the corner point position information, Perform camera internal parameter calibration.

Benefits of technology

It reduces operation time and cost, can complete camera parameter calibration in one shot, improves efficiency, and is suitable for industrial production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112927301B
    Figure CN112927301B
Patent Text Reader

Abstract

The present application is applicable to the field of parameter calibration technology, and provides a camera calibration method, device, computing equipment and readable storage medium, including: obtaining a first image taken by a camera, the first image containing A checkerboards; generating A second images according to the first image, the image size of each second image is the same as the image size of the first image, each second image includes a checkerboard area and a non-checkerboard area, the checkerboard area of ​​each second image contains one of the A checkerboards, the positions of the checkerboards in the checkerboard areas of each second image are the same as the positions of the checkerboards in the first image, and the non-checkerboard area contains content different from the checkerboards; obtaining the corner point position information of the checkerboards in each second image; calibrating the intrinsic parameters of the camera according to the corner point position information. The present application can reduce operation time and reduce costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of parameter calibration technology, and in particular, relates to a camera calibration method, apparatus, computing device and readable storage medium. Background Art

[0002] At present, the common method for calibrating the intrinsic parameters of RGB cameras is to use an RGB camera to take about 20 chessboard images at different angles and distances, and then extract the corner information of each image for opencv intrinsic parameter calibration. However, this intrinsic parameter calibration method requires continuous shooting of at least 20 chessboards to complete a calibration, and each chessboard has a different angle and distance from the camera, which requires a long operation time and high cost. Summary of the invention

[0003] The embodiments of the present application provide a camera calibration method, apparatus, computing device and readable storage medium, which can reduce operation time and cost and can be easily applied to industrial production.

[0004] In a first aspect, an embodiment of the present application provides a camera calibration method, the method comprising:

[0005] Acquire a first image captured by a camera, wherein the first image includes A chessboard squares, where A is an integer greater than 1;

[0006] Generate A second images according to the first image, wherein the image size of each of the second images is the same as that of the first image, each of the second images includes a checkerboard area and a non-checkerboard area, the checkerboard area of ​​each of the second images respectively contains one of the A checkerboards, the positions of the checkerboards in the checkerboard area of ​​each of the second images are the same as the positions of the checkerboards in the first image, and the non-checkerboard area contains content different from the checkerboards;

[0007] Obtaining the corner point position information of the checkerboard in each of the second images;

[0008] The intrinsic parameters of the camera are calibrated according to the position information of each corner point to obtain the calibrated intrinsic parameters of the camera.

[0009] It should be understood that the position of each non-chessboard area of ​​the second image is the same as the position of the area where the remaining A-1 chessboards in the first image are located.

[0010] In a possible implementation manner of the first aspect, the method further includes:

[0011] Comparing the calibrated intrinsic parameters with the standard intrinsic parameters corresponding to the camera to obtain a comparison result;

[0012] If the comparison result meets the preset first condition, a new first image taken by the camera is obtained, and the step of generating A second images based on the first image and subsequent steps are returned to execute, wherein the new first image contains A chessboards, and the angle and / or position of at least one chessboard in the new first image is different from that before.

[0013] In a possible implementation manner of the first aspect, acquiring the corner point position information of the checkerboard in each of the second images includes:

[0014] Calculating a covariance matrix for each pixel in each of the second images;

[0015] Determine the corner point correlation value of each pixel according to the covariance matrix;

[0016] The corner point position information is determined according to the corner point correlation value.

[0017] Exemplarily, the value of A is 8; the angle and position of each chessboard are different; the 4 groups of chessboards are located in the length direction of the first image, and each group of chessboards contains 2 chessboards located in the width direction of the first image.

[0018] Exemplarily, A is an integer greater than 2; the angle and position of each chessboard square are different.

[0019] In a second aspect, an embodiment of the present application provides a camera calibration device, the device comprising:

[0020] An image acquisition unit, configured to acquire a first image captured by a camera, wherein the first image includes A chessboard grids, where A is an integer greater than 1;

[0021] A second image generating unit, configured to generate A second images according to the first image, wherein the image size of each of the second images is the same as that of the first image, each of the second images includes a checkerboard area and a non-checkerboard area, the checkerboard area of ​​each of the second images respectively contains one of the A checkerboards, the positions of the checkerboards in the checkerboard area of ​​each of the second images are the same as the positions of the checkerboards in the first image, and the non-checkerboard area contains content different from the checkerboards;

[0022] A corner point position information acquisition unit, used to acquire the corner point position information of the checkerboard in each of the second images;

[0023] The intrinsic parameter calibration unit is used to calibrate the intrinsic parameters of the camera according to the position information of each corner point to obtain the calibrated intrinsic parameters of the camera.

[0024] In a third aspect, an embodiment of the present application provides a computing device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the methods described in the first aspect when executing the computer program.

[0025] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the above-mentioned first aspects is implemented.

[0026] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute any of the methods described in the first aspect above.

[0027] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0028] In an embodiment of the present application, a first image captured by a camera and containing A checkerboards is obtained, wherein A is an integer greater than 1, and A second images are generated based on the acquired first image, wherein the image size of each second image is the same as the image size of the first image, and each second image contains a checkerboard area and a non-checkerboard area, and the checkerboard area of ​​each second image contains one checkerboard out of the A checkerboards, and the positions of the checkerboards in the checkerboard area of ​​each second image are the same as the positions of the checkerboards in the first image, and the non-checkerboard area contains content different from the checkerboards, and the corner point position information of the checkerboards of each second image is obtained, and the intrinsic parameters of the camera are calibrated based on the corner point position information to obtain the calibrated intrinsic parameters of the camera; in this way, the intrinsic parameters of the camera can be calibrated once by shooting the checkerboard, which can improve efficiency, reduce operation time and reduce costs, and is easily applicable to industrial production.

[0029] Some possible implementations of the embodiments of the present application have the following beneficial effects:

[0030] The color value of each pixel in the A-1 checkerboard areas in each divided first image is set to the same value, the covariance matrix of each pixel in each second image is calculated, and the corner point correlation value of each pixel is determined according to the covariance matrix, and then the corner point is determined according to the corner point correlation value, so as to obtain the corner point position information to complete the calibration of the camera's intrinsic parameters; in this way, the calibration can be completed quickly, making the project implementation easier;

[0031] The obtained calibrated intrinsic parameters are compared with the standard intrinsic parameters corresponding to the camera to obtain a comparison result; if the comparison result meets the preset first condition, a new first image taken by the camera is obtained, and the step of generating A second images based on the first image and subsequent steps are returned, wherein the new first image contains A chessboards, and the angle and / or position of at least one chessboard in the new first image is different from that before; in this way, A new second images are generated based on the new first image, and the new corner point position information of the chessboard of each new second image is obtained, and the new calibrated intrinsic parameters of the camera are obtained accordingly, so as to be used for the subsequent camera to correct image distortion, and an image with relatively small distortion can be obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0033] Figure 1 It is a flowchart of the camera calibration method provided in Example 1 of the present application;

[0034] Figure 2 is the first image provided in Example 1 of the present application;

[0035] Figure 3 is the first second image provided in Example 1 of the present application;

[0036] Figure 4 is the second second image provided in Example 1 of the present application;

[0037] Figure 5 is the third second image provided in Example 1 of the present application;

[0038] Figure 6 is the fourth second image provided in Example 1 of the present application;

[0039] Figure 7 It is a flowchart of a variant of the camera calibration method provided in Example 1 of the present application;

[0040] Figure 8 is a flowchart of a camera calibration method provided in Embodiment 2 of the present application;

[0041] Fig. 9 is a structural schematic diagram of a camera calibration device provided in Embodiment 3 of the present application;

[0042] Fig.10is a structural schematic diagram of a second image generating unit provided in Embodiment 3 of the present application;

[0043] Fig.11 is a structural diagram of a corner point position information acquisition unit provided in Embodiment 3 of the present application;

[0044] Fig.12 It is a structural diagram of a variant of the camera calibration device provided in the third embodiment of the present application;

[0045] Fig.13 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0046] Fig.14 It is a logic diagram of the camera calibration method provided in Example 1 of the present application. DETAILED DESCRIPTION

[0047] In order to make the technical problems, technical solutions and beneficial effects to be solved by this application clearer, the following Figures 1 to 14 It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0048] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0049] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0050] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0051] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0052] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0053] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0054] Embodiment 1

[0055] The present embodiment provides a camera calibration method, which can calibrate the intrinsic parameters of the camera; wherein the intrinsic parameters of the camera include focal length, image principal point coordinates and distortion parameters. The camera calibration method provided in the present embodiment can be applied to a household visual sweeping robot, specifically a household visual sweeping robot (hereinafter referred to as the robot) deployed with an RGB camera. The intrinsic parameters of the RGB camera can be calibrated when the robot leaves the factory; after the calibration is completed, the calibrated intrinsic parameters are written into the robot's storage device such as flash (a non-volatile memory) for use by the RGB camera when performing image distortion correction. The camera calibration method provided in the present embodiment can also be applied to mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA) and other computing devices. The present application embodiment does not impose any restrictions on the specific type of computing device.

[0056] Figure 1 The schematic flow chart of the camera calibration method provided in this embodiment is shown. As an example but not a limitation, the method can be applied to the above-mentioned household visual sweeping robot. The camera calibration method provided in this embodiment includes steps S11 to S14.

[0057] Step S11, obtaining a first image captured by a camera, wherein the first image includes A chessboard grids, where A is an integer greater than 1.

[0058] This embodiment is described by taking A equal to 4 as an example. The RGB camera of a household visual sweeping robot is the camera to be calibrated.

[0059] Figure 2It is the first image provided by the present embodiment, which includes four chessboards. Each chessboard is a picture with a chessboard, and its carrier can be a board or paper, such as printing the chessboard on the board or paper. The four chessboards are fixed at a set angle and a set position with a bracket, such as fixing the four chessboards with a metal frame or fixing the four chessboards with four metal frames respectively, and the angle of each chessboard and the distance of each chessboard from the RGB camera are adjusted so that the four chessboards are fixed on the bracket at a set angle and a set position; the four chessboards are staggered in space. Among them, the set angle determines the direction of the chessboard, such as up, down, left or right. After completing the adjustment of the angle and distance, an image is taken by the RGB camera of the household visual sweeping robot, such as the RGB camera captures a frame of image, which is the aforementioned first image, reference Figure 2 , which contains the aforementioned four chessboards. It is easy to understand that the distance between the four chessboards (or calibration plates) and the RGB camera is limited to a certain extent. To ensure that the image captured by the RGB camera contains the four chessboards, this needs to be confirmed during the debugging stage.

[0060] refer to Figure 2 In the first image, the four checkerboards are staggered. Specifically, each checkerboard can be fully displayed in the first image, and there is no situation where one checkerboard overlaps with another checkerboard.

[0061] After the RGB camera captures the first image, the household visual sweeping robot obtains the first image. In other embodiments, the first image may also be received from other devices such as a smart terminal.

[0062] Step S12, generating A second images according to the first image, wherein the image size of each second image is the same as the image size of the first image.

[0063] After acquiring the first image, four second images are generated, each of which has the same image size as the first image. The first image and the second image are both planar images, and the image size refers to the length and width of the image or the resolution of the image. For example, if the image size of the first image is 256mm×256mm, then the size of each second image is also 256mm×256mm. Figures 3 to 6 These are four second images provided in this embodiment, and these four second images all contain a checkerboard area 100 and a non-checkerboard area 200, specifically, one checkerboard area 100 and one non-checkerboard area 200. The checkerboard areas 100 of these four second images respectively contain one of the aforementioned four checkerboards, and the aforementioned four checkerboards are respectively located in the checkerboard areas 100 of different second images, that is, the checkerboards contained in the checkerboard areas 100 of these four second images are different.

[0064] The positions of the checkerboards in the checkerboard area 100 of the four second images are respectively the same as the positions of the four checkerboards in the first image; for example, refer to Figure 2 and Figure 3 , if the chessboard contained in the chessboard area 100 of a second image is located at the upper left corner in the first image, then the chessboard area 100 containing this chessboard is also located at the upper left corner of the second image; thus, the positions of the four chessboards in the chessboard areas 100 of the four second images are the same as the positions of the four chessboards in the first image. In the first image, the size of the area where a chessboard is located can be exactly the same as the size of a chessboard, or it can be larger than the size of a chessboard. The size of the chessboard area 100 in the second image is the same as the size of the area where a chessboard is located in the first image, and a chessboard area 100 contains only one chessboard.

[0065] refer to Figure 3 The second image also includes a non-chessboard area 200. The non-chessboard area 200 contains content different from the chessboard and is an area without a chessboard. Figure 2 and Figure 3 , the position of the non-chessboard area 200 of each second image is the same as the position of the area where the remaining A-1 chessboards in the first image are located, then the non-chessboard area 200 of the second image corresponds to the area where the remaining A-1 chessboards in the first image are located; in this embodiment, A-1 chessboards are three chessboards; for example, refer to Figure 2 and Figure 3 , the positions of the remaining three checkerboards in the first image are the upper right corner, the lower left corner and the lower right corner, respectively. Then, the aforementioned non-checkerboard area is composed of the area of ​​the upper right corner, the area of ​​the lower left corner and the area of ​​the lower right corner of the second image. It should be understood that in the second image, after the position of the checkerboard area 100 is determined, the position of the non-checkerboard area 200 in the second image is also determined, because the area other than the checkerboard area 100 in the second image is the non-checkerboard area 200.

[0066] In some other embodiments, step S12 of generating four second images includes steps S121 to S123.

[0067] Step S121, dividing the first image into four checkerboard areas to generate a divided first image, each checkerboard area containing a checkerboard.

[0068] After obtaining the first image containing four checkerboards, the first image is divided into four checkerboard areas 100, which can be specifically numbered according to a specified rule, such as the first checkerboard area, the second checkerboard area, the third checkerboard area and the fourth checkerboard area in a clockwise direction, each checkerboard area containing a checkerboard.

[0069] Example, reference Figure 2 , draw a line in the horizontal direction and the vertical direction of the first image to divide the first image into four areas, so that each area has a chessboard grid.

[0070] The aforementioned division is to divide the first image into four parts according to a specified rule, so as to ensure that each part can contain the corresponding chessboard. In this way, the first image of the divided area is obtained, that is, the first image after division.

[0071] Step S122, copying the divided first image into four images.

[0072] After obtaining the divided first image, the first image is divided into four images according to the specified splitting logic; specifically, the specified splitting logic is executed, the divided first image is copied, and four divided first images are generated.

[0073] Step S123, processing the three checkerboard areas in each divided first image into non-checkerboard areas, generating four second images, wherein the checkerboard areas retained in each second image are different, wherein the non-checkerboard areas are obtained by removing the checkerboards.

[0074] Each of the four divided first images has four checkerboard areas 100. In this embodiment, the three checkerboard areas 100 in each divided first image are processed into non-checkerboard areas 200 by setting the pixel value of each pixel of the three checkerboard areas 100 in each divided first image to the same value, the range of which is 0 to 255, for example, setting the pixel value of each pixel of the three checkerboard areas 100 to 1, as long as the three checkerboard areas 100 have no checkerboards.

[0075] refer to Figure 3 , the second checkerboard area, the third checkerboard area and the fourth checkerboard area in the first divided first image are processed into non-checkerboard areas, specifically, the pixel values ​​of each pixel in the second checkerboard area, the third checkerboard area and the fourth checkerboard area are all set to 1, and the first second image is generated. Among them, the area where the pixel values ​​are all set to 1 is pure white.

[0076] refer to Figure 4, the first checkerboard area, the third checkerboard area and the fourth checkerboard area in the second divided first image are processed into non-checkerboard areas, specifically, the pixel value of each pixel in the first checkerboard area, the third checkerboard area and the fourth checkerboard area is set to 1, and a second second image is generated.

[0077] refer to Figure 5 , the first checkerboard area, the second checkerboard area and the fourth checkerboard area in the third divided first image are processed into non-checkerboard areas, specifically, the pixel value of each pixel in the first checkerboard area, the second checkerboard area and the fourth checkerboard area is set to 1, and the third second image is generated.

[0078] refer to Figure 6 , the first checkerboard area, the second checkerboard area and the third checkerboard area in the fourth divided first image are processed into non-checkerboard areas, specifically, the pixel value of each pixel in the first checkerboard area, the second checkerboard area and the third checkerboard area is set to 1, and a fourth second image is generated.

[0079] In some other embodiments, the first image is first divided into four checkerboard areas to generate four non-checkerboard images, such as blank images, with the same image size as the first image. The four checkerboard areas in the first image are respectively moved or copied to corresponding positions of the four blank images, such as copying the checkerboard area in the upper left corner of the first image to the upper left corner of a blank image, copying the checkerboard area in the lower left corner of the first image to the lower left corner of the second blank image, copying the checkerboard area in the upper right corner of the first image to the upper right corner of the third blank image, and copying the checkerboard area in the lower right corner of the first image to the lower right corner of the fourth blank image, thereby generating four second images; these four second images also contain checkerboard areas and non-checkerboard areas.

[0080] In this way, the first image is split into four second images, each of which includes a chessboard, so that four second images are obtained.

[0081] Step S13, obtaining the corner point position information of each checkerboard of the second image.

[0082] After acquiring the four second images, corner points are extracted from the four second images in sequence. Specifically, the opencvharris corner point detection algorithm can be used to extract the corner points.

[0083] In some other embodiments, step S13 of acquiring corner point position information includes steps S131 to S133.

[0084] Step S131, calculating the covariance matrix of each pixel of each second image.

[0085] In this embodiment, a 2*2 covariance matrix M is calculated for each pixel in the four second images.

[0086] Step S132, determining the corner point correlation value of each pixel according to the covariance matrix.

[0087] According to the covariance matrix M obtained in step S131, the corner point correlation value R is calculated.

[0088] R = det(M) - k*(trace(M) 2 ).

[0089] det(M) is the determinant of the covariance matrix M, det(M) = λ1*λ2, λ1 and λ2 are the eigenvalues ​​of the covariance matrix M; k is a custom constant, generally the value of k is between 0.04 and 0.06, and the value range of k in opencv is larger; trace(M) is a function used to solve the trace of the covariance matrix M, where the matrix M of this embodiment is a two-dimensional square matrix, then trace(M) is to find the trace of the two-dimensional square matrix (that is, the sum of the elements on the diagonal of the square matrix), trace(M) = λ1+λ2.

[0090] In this way, the corner point correlation value R of each pixel can be determined.

[0091] Step S133, determining the corner point position information according to the corner point correlation value R.

[0092] After calculating the corner point correlation value R, the value of R is judged. If the R value of a pixel is greater than the set first threshold, where the first threshold is the maximum threshold greater than zero, indicating that the R value is relatively large, then the pixel corresponding to the R value is the corner point position; if the R value is negative, it indicates that the pixel is an edge; if the R value is less than the set second threshold, where the second threshold is the minimum threshold greater than zero, indicating that the R value is very small, then the pixel corresponding to the R value is a flat area. It is easy to understand that the first threshold is greater than the second threshold.

[0093] By ensuring that each second image contains only one chessboard, it can be ensured that the corner points of the chessboard extracted from a second image are the corner points corresponding to this chessboard, thus avoiding the situation where it is unknown which chessboard the extracted corner points belong to.

[0094] In this way, the corner points in the four second images can be determined, and then the position information of the corner points can be determined.

[0095] After the corner points in the four second images are extracted, the corner point position information of each image can be obtained. For example, the corner point position information is the coordinates of the corner points, and the coordinates of each corner point can be obtained by establishing coordinate systems for the four second images respectively.

[0096] Step S14, calibrating the intrinsic parameters of the camera according to the position information of each corner point to obtain the calibrated intrinsic parameters of the camera.

[0097] After obtaining the corner point position information (such as corner point coordinates) of each second image, the corner point coordinates of each second image are input into the interface of the opencv calibration model (or opencv calibration algorithm), such as the calibrateCamera function, to obtain the intrinsic parameters of the camera, that is, all corner points are sent to the opencv calibration model for calibration. The obtained intrinsic parameters are used as the calibration intrinsic parameters of the camera for subsequent correction of image distortion, and the calibration of the intrinsic parameters of the camera is completed.

[0098] Based on the above, it can be seen that by shooting four chessboards at a time, the internal parameters of the camera can be calibrated once, which can improve efficiency, reduce operation time and reduce costs, and can be easily applied to industrial production.

[0099] refer to Figure 7 The camera calibration method provided in this embodiment also includes steps S15 to S17.

[0100] Step S15, if the acquired corner point position information meets the preset second condition, a new first image taken by the camera is acquired, the new first image contains A chessboards, and the angle and / or position of at least one chessboard in the new first image is different from the previous one.

[0101] Camera shaking and other situations will cause the first image captured to be blurred and cannot be used to determine the corner point location information. In order to ensure that the corner point location information can be determined, refer to Fig.14 , determine whether the acquired corner point position information meets the preset second condition; in this embodiment, the second condition is that at least a part of the corner point position information cannot be acquired, such as the corner point position information of the second second image cannot be acquired. Since in this embodiment, the corner points are determined first and then the corner point position information is determined, it can be determined whether the corner points of the four second images are all extracted successfully. As long as the corner point extraction of one second image fails, it is determined that the acquisition of the corner point position information fails; for example, if the corner points of the checkerboard of a second image cannot be extracted, or the number of extracted corner points is less than the set number (where the set number is an integer greater than zero), it is determined that the corner point extraction fails, that is, the acquisition of the corner point position information fails.

[0102] In case of failure to obtain corner point position information, the household visual sweeping robot obtains a new first image, which is taken by the camera of the household visual sweeping robot and includes four chessboards; the angle and / or position of at least one chessboard in the new first image is different from that of the previous one; for example, the angle and position of the four chessboards are changed, and then the first image is re-shot, so that the angle and position of the four chessboards in the new first image are changed compared with the angle and position of the four chessboards in the previous first image; in some other embodiments, the angle of the four chessboards may be changed, or the position of the four chessboards may be changed, and then the first image may be re-shot.

[0103] In this way, a new first image is obtained, and then the process returns to the step of generating A second images according to the first image and subsequent steps, as described in detail below.

[0104] Step S16, generating A new second images according to the new first image.

[0105] Specifically, four new second images are generated according to the acquired new first image.

[0106] Like the previous four second images, the four new second images all contain a checkerboard area and a non-checkerboard area. The checkerboard areas of the four new second images each contain one of the four checkerboards, and the four checkerboards are located in checkerboard areas of different new second images. Compared with the previous second images, the angle and position of the checkerboard at the same position in the new second image, such as the upper left corner, have changed, that is, the angle and position of the checkerboard at the upper left corner of the new second image are different from the angle and position of the checkerboard at the upper left corner of the previous second image.

[0107] Like the previous four second images, the position of the non-checkerboard area of ​​each new second image is the same as the position of the area where the remaining three checkerboards in the new first image are located. Therefore, the non-checkerboard area of ​​the new second image containing one checkerboard corresponds to the area where the remaining three checkerboards in the new first image are located.

[0108] Step S17, obtaining the corner point position information of each new chessboard of the second image.

[0109] After generating four new second images, obtain the corner point position information of the checkerboard. Specifically, the OpenCV Harris corner point detection algorithm can be used to extract the corner points of the four new second images in sequence. After extracting the corner points in the four new second images, the corner point position information of each image, such as the corner point coordinates, can be obtained. Then, the intrinsic parameters of the camera are determined according to the corner point position information to complete the intrinsic parameter calibration of the camera.

[0110] In this way, the stable operation of the system can be guaranteed and the anti-interference ability of the system can be improved.

[0111] Embodiment 2

[0112] Compared with Example 1, reference Figure 8 The camera calibration method provided in this embodiment also includes steps S21 to S25.

[0113] Step S21, comparing the calibrated intrinsic parameters with the standard intrinsic parameters corresponding to the camera to obtain a comparison result.

[0114] The calibration intrinsic parameters determined above are the calibration results of the camera. Each camera has a corresponding standard result, and the standard result is the standard intrinsic parameter. Compare the calculated calibration intrinsic parameters with the standard intrinsic parameters corresponding to the camera to obtain the comparison result.

[0115] Step S22, if the comparison result meets the preset first condition, a new first image captured by the camera is obtained, the new first image contains A chessboards, and the angle and / or position of at least one chessboard in the new first image is different from that of the previous one.

[0116] Step S22 is to determine whether the comparison result in step S21 meets the preset first condition. Specifically, if the calculated internal parameter (i.e., calibration result) is significantly different from the standard result (standard internal parameter), for example, the difference between the calibration result and the standard result is greater than the set value, it is determined that the calibration has failed; if the difference between the calibration result and the standard result is less than the set value, it is determined that the calibration has succeeded. Among them, calibration failure is the aforementioned first condition, and correspondingly, the first condition is that the difference between the calibration internal parameter and the standard internal parameter is greater than the set value.

[0117] For the case where the comparison result is calibration failure, that is, the comparison result meets the first condition, the household visual sweeping robot obtains a new first image, which is taken by the camera of the household visual sweeping robot and contains four chessboards; the angle and / or position of at least one chessboard in the new first image is different from that of the previous one; for example, the angle and position of the four chessboards are changed, and then the first image is re-shot, then the angle and position of the four chessboards in the new first image are changed compared with the angle and position of the four chessboards in the previous first image; in some other embodiments, the angle of the four chessboards may be changed, or the position of the four chessboards may be changed, and then the first image may be re-shot.

[0118] In this way, a new first image is obtained, and then the process returns to the step of generating A second images according to the first image and subsequent steps, as described in detail below.

[0119] Step S23, generating A new second images according to the new first image.

[0120] Four new second images are generated based on the acquired new first image. Like the previous four second images, the four new second images all contain a checkerboard area and a non-checkerboard area. The checkerboard areas of the four new second images each contain one of the aforementioned four checkerboards, and the aforementioned four checkerboards are respectively located in the checkerboard areas of different new second images. Compared with the previous second image, the angle and position of the checkerboard at the same position in the new second image, such as the upper left corner, have changed, that is, the angle and position of the checkerboard at the upper left corner of the new second image are different from the angle and position of the checkerboard at the upper left corner of the previous second image.

[0121] Like the previous four second images, the non-chessboard area of ​​the new second image corresponds to the area where the remaining three chessboards in the new first image are located.

[0122] Step S24, obtaining new corner point position information of each new chessboard of the second image.

[0123] After generating four new second images, the corner point position information of the checkerboard is obtained, and the corner point position information is the new corner point position information. Specifically, the opencvharris corner point detection algorithm can be used to sequentially extract the corner points of the four new second images. After extracting the corner points in the four new second images, the new corner point position information of each image, such as the new corner point coordinates, can be obtained.

[0124] Step S25, calibrating the intrinsic parameters of the camera according to the new corner point position information to obtain new calibrated intrinsic parameters of the camera.

[0125] After obtaining the corner point coordinates of each new second image, the corner point coordinates of each new second image are input into the interface of the opencv calibration model, such as the calibrateCamera function, to obtain new calibration intrinsic parameters of the camera.

[0126] Then the new calibration internal parameters are compared with the standard internal parameters corresponding to the camera to generate a new comparison result. If the new comparison result meets the preset third condition, where the third condition is that the difference between the calibration internal parameters and the standard internal parameters is less than the set value, indicating that the calibration is successful, the new calibration parameters are written into the robot's storage device such as flash for subsequent RGB image distortion correction. Specifically, the new internal parameters are used to correct the images taken by the camera later, so that images with relatively small distortion can be obtained.

[0127] In this embodiment, the calibration parameters obtained by shooting four (or more) chessboards at one time are close to the calibration parameters obtained by shooting 20 chessboards separately. Experimental data show that the difference between the parameter values ​​calibrated by the two is within 0.005, so the calibration results of the two cases are almost the same. The embodiment of the present application can reduce the number of shots as much as possible, so that the number of shots of the chessboard is reduced from multiple times to once, which can significantly reduce the operation time and reduce the cost, so it can significantly improve the efficiency.

[0128] In some other embodiments, the value of A is 8, and the camera captures 8 chessboard squares at one time; the angle and position of each chessboard square are different, some chessboard squares are directly downward or upward at a certain angle, and some chessboard squares are diagonally downward or upward at a certain angle; the 8 chessboard squares are divided into 4 groups, the 4 groups of chessboard squares are located in the length direction of the first image, and each group of chessboard squares contains 2 chessboard squares located in the width direction of the first image.

[0129] The principle of calibrating the internal parameters of the chessboard requires the use of at least three chessboards. During the experiment, for 100 household visual sweeping robots, the technical solution of shooting eight chessboards at a time to calibrate the internal parameters of the robot's camera has a success rate of 100%, which can achieve the effect of shooting 20 chessboards to calibrate the internal parameters; the technical solution of shooting four chessboards at a time to calibrate the internal parameters of the robot's camera has a success rate of 95%, which can achieve the effect of shooting 20 chessboards to calibrate the internal parameters; the technical solution of shooting three chessboards at a time to calibrate the internal parameters of the robot's camera cannot achieve the effect of shooting 20 chessboards to calibrate the internal parameters. According to the above experimental data, the effect of calibrating the internal parameters using eight chessboards is better than that of four, and the effect of four is better than that of three; the use of eight and four chessboards to calibrate the internal parameters can both achieve the effect of shooting 20 chessboards to calibrate the internal parameters.

[0130] Embodiment 3

[0131] Corresponding to the method described in the above embodiment, Fig. 9 A structural block diagram of a camera calibration device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0132] refer to Fig. 9 The device includes an image acquisition unit 11, a second image generation unit 12, a corner point position information acquisition unit 13 and an internal parameter calibration unit 14.

[0133] The image acquisition unit 11 is used to acquire a first image taken by a camera, wherein the first image includes A chessboard grids.

[0134] The second image generating unit 12 is used to generate A second images according to the first image, and the image size of each second image is the same as the image size of the first image.

[0135] The corner point position information acquisition unit 13 is used to acquire the corner point position information of each checkerboard of the second image.

[0136] The intrinsic parameter calibration unit 14 is used to calibrate the intrinsic parameters of the camera according to the position information of each corner point to obtain the calibrated intrinsic parameters of the camera.

[0137] refer to Fig.10 The second image generating unit 12 includes a region dividing unit 121 , an image copying unit 122 and a checkerboard region processing unit 123 .

[0138] The region division unit 121 is used to divide the first image into A checkerboard regions to obtain the divided first image, each checkerboard region containing a checkerboard.

[0139] The image copying unit 122 is used to copy the divided first image into A sheets.

[0140] The checkerboard area processing unit 123 is used to process A-1 checkerboard areas in each divided first image into non-checkerboard areas to generate A second images, and the checkerboard areas retained in each second image are different.

[0141] refer to Fig.11 The corner point position information acquiring unit 13 includes a covariance matrix calculating unit 131 , a corner point correlation value determining unit 132 and a corner point position information determining unit 133 .

[0142] The covariance matrix calculation unit 131 is used to calculate the covariance matrix of each pixel of each second image.

[0143] The corner point correlation value determining unit 132 is used to determine the corner point correlation value of each pixel according to the covariance matrix.

[0144] The corner point position information determining unit 133 is used to determine the corner point position information according to the corner point correlation value.

[0145] The image acquisition unit 11 is also used for: if the acquired corner point position information meets the preset second condition, then acquiring a new first image taken by the camera, the new first image containing A chessboards, and the angle and / or position of at least one chessboard in the new first image is different from that before.

[0146] The second image generating unit 12 is further configured to generate A new second images according to the new first images.

[0147] The corner point position information acquisition unit 13 is further used to acquire the corner point position information of the checkerboard of each new second image.

[0148] refer to Fig.12 The camera internal parameter calibration device provided in this embodiment also includes a parameter comparison unit 21.

[0149] The parameter comparison unit 21 is used to compare the calibrated intrinsic parameters with the standard intrinsic parameters corresponding to the camera to obtain a comparison result.

[0150] The image acquisition unit 11 is also used to: if the comparison result meets the preset first condition, obtain a new first image taken by the camera, the new first image contains A chessboards, and the angle and / or position of at least one chessboard in the new first image is different from the previous one.

[0151] The second image generating unit 12 generates A new second images based on the new first images.

[0152] The corner point position information acquisition unit 13 is further used to acquire new corner point position information of each new checkerboard of the second image.

[0153] The intrinsic parameter determination unit 14 is further used to determine new calibration intrinsic parameters of the camera according to each new corner point position information.

[0154] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0155] Fig.13 This is a schematic diagram of the structure of a computing device provided in one embodiment of the present application. Fig.13 As shown, the computing device 13 of this embodiment includes: at least one processor 130 ( Fig.13 Only one is shown in the figure), a memory 131, and a computer program 132 stored in the memory 131 and executable on at least one processor 130; when the processor 130 executes the computer program 132, the steps in the above-mentioned method embodiments are implemented.

[0156] The computing device 13 may be a desktop computer, a notebook, a PDA, a cloud server, or other computing device. The computing device may include, but is not limited to, a processor 130 and a memory 131. Those skilled in the art will appreciate that Fig.13 These are merely examples of computing devices and do not constitute limitations on the computing devices. The computing devices may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, the computing devices may also include input and output devices, network access devices, buses, etc.

[0157] The processor 130 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0158] In some embodiments, the memory 131 may be an internal storage unit of the computing device 13, such as a hard disk or memory of the computing device. In other embodiments, the memory 131 may also be an external storage device of the computing device, such as a plug-in hard disk equipped on the computing device, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 131 may also include both an internal storage unit of the computing device and an external storage device. The memory 131 is used to store an operating system, an application program, a boot loader, data, and other programs, such as program codes of a computer program. The memory 131 may also be used to temporarily store data that has been output or is to be output.

[0159] Exemplarily, the computer program 132 may be divided into one or more modules / units, one or more modules / units are stored in the memory 131, and executed by the processor 130 to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 132 in the computing device 13.

[0160] The current RGB camera internal parameter calibration method requires continuous shooting of at least 20 chessboards, and each chessboard has a different angle and distance from the camera. Since this method requires multiple chessboards to complete a calibration, it is currently only suitable for debugging or experimental purposes. In actual applications, this method takes a long time to operate and is costly, and the efficiency is very low, making it difficult to use in industrial production. Compared with the current technical solution, the technical solution provided by the embodiment of the present application only requires shooting a chessboard once to complete a calibration, which can greatly reduce the actual production operation time and reduce costs, making the project implementation simpler, and only requires one shot to complete a camera internal parameter calibration.

[0161] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0162] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0163] If the aforementioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium; when the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. Computer-readable media include: any entity or device that can carry computer program code to a device / terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0164] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0165] An embodiment of the present application provides a computer program product. When the computer program product is executed on a terminal device such as a computer, the computer can implement the steps in the above-mentioned various method embodiments.

[0166] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0167] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0168] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are merely schematic, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0169] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0170] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A camera calibration method, characterized in that: The method comprises: Acquire a first image captured by a camera, wherein the first image includes A chessboard grids, where A is an integer greater than 1; the A chessboard grids are staggered, and no chessboard grid overlaps another chessboard grid; Generate A second images according to the first image, wherein the image size of each of the second images is the same as that of the first image, each of the second images includes a checkerboard area and a non-checkerboard area, the checkerboard area of ​​each of the second images respectively contains one of the A checkerboards, the positions of the checkerboards in the checkerboard area of ​​each of the second images are the same as the positions of the checkerboards in the first image, and the non-checkerboard area contains content different from the checkerboards; Obtaining the corner point position information of the checkerboard in each of the second images; Calibrate the intrinsic parameters of the camera according to the position information of each corner point to obtain the calibrated intrinsic parameters of the camera; The step of generating A second images according to the first image comprises: Dividing the first image into A checkerboard regions to obtain a divided first image, each of the checkerboard regions containing one checkerboard; Copying the divided first image into A sheets; A-1 checkerboard areas in each of the divided first images are processed into non-checkerboard areas to obtain A second images, and the checkerboard areas retained in each of the second images are different.

2. The method according to claim 1, characterized in that The method further comprises: Comparing the calibrated intrinsic parameters with the standard intrinsic parameters corresponding to the camera to obtain a comparison result; If the comparison result meets the preset first condition, which is that the difference between the calibrated internal parameters and the standard internal parameters is greater than the set value, a new first image taken by the camera is obtained, and the step of generating A second images based on the first image and subsequent steps are returned to execute, the new first image contains A chessboards, and the angle and / or position of at least one chessboard in the new first image is different from that before.

3. The method according to claim 1, characterized in that The obtaining the corner point position information of the checkerboard in each of the second images includes: Calculating a covariance matrix for each pixel in each of the second images; Determine the corner point correlation value of each pixel according to the covariance matrix; The corner point position information is determined according to the corner point correlation value.

4. The method according to claim 3, characterized in that The determining the corner point position information according to the corner point correlation value comprises: If the corner point correlation value is greater than a set first threshold, the pixel corresponding to the corner point correlation value is determined as a corner point, and the corner point position information is determined based on the corner point, and the first threshold is greater than zero.

5. The method according to claim 1, characterized in that The processing of A-1 checkerboard areas in each of the divided first images into non-checkerboard areas includes: The pixel value of each pixel in the A-1 checkerboard areas in each of the divided first images is set to the same value.

6. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: If the acquired corner point position information meets a preset second condition, and the preset second condition is that at least a part of the corner point position information cannot be acquired, then a new first image taken by the camera is acquired, and the step of generating A second images based on the first image and subsequent steps are returned to execute, wherein the new first image contains A chessboards, and the angle and / or position of at least one chessboard in the new first image is different from that before.

7. A camera calibration device, characterized in that: The device comprises: An image acquisition unit is used to acquire a first image captured by a camera, wherein the first image includes A chessboard grids, where A is an integer greater than 1; the A chessboard grids are staggered, and no chessboard grid overlaps another chessboard grid; A second image generating unit, configured to generate A second images according to the first image, wherein the image size of each of the second images is the same as that of the first image, each of the second images includes a checkerboard area and a non-checkerboard area, the checkerboard area of ​​each of the second images respectively contains one of the A checkerboards, the positions of the checkerboards in the checkerboard area of ​​each of the second images are the same as the positions of the checkerboards in the first image, and the non-checkerboard area contains content different from the checkerboards; A corner point position information acquisition unit, used to acquire the corner point position information of the checkerboard in each of the second images; An intrinsic parameter calibration unit, used to calibrate the intrinsic parameters of the camera according to the position information of each corner point, so as to obtain the calibrated intrinsic parameters of the camera; The second image generation unit includes a region division unit, an image replication unit and a checkerboard region processing unit; A region division unit, used for dividing the first image into A chessboard regions to obtain the divided first image, each chessboard region containing a chessboard; An image copying unit, used for copying the divided first image into A sheets; The checkerboard area processing unit is used to process A-1 checkerboard areas in each divided first image into non-checkerboard areas to generate A second images, and the checkerboard areas retained in each second image are different.

8. A computing device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.