Camera calibration method and device, electronic equipment and storage medium
By acquiring images of the checkerboard calibration board, performing grayscale conversion and corner feature extraction, and using the least squares method to solve camera parameters, a human-computer interaction interface is provided. This solves the problem of complex and time-consuming camera calibration process, achieving high-precision and efficient camera calibration that is adaptable to various environmental conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN HONGJI OPTICAL GLASS NEW MATERIAL TECH CO LTD
- Filing Date
- 2026-01-23
- Publication Date
- 2026-05-01
AI Technical Summary
Existing camera calibration methods are complex, time-consuming, and labor-intensive, and are easily affected by lighting and noise, resulting in low calibration accuracy, which makes it difficult to meet the high-precision requirements of industrial production and autonomous driving.
By acquiring a chessboard calibration board image, performing grayscale processing on the chessboard calibration board image, extracting corner features, solving the camera intrinsic and extrinsic parameters using the least squares method, and providing a human-computer interaction interface for real-time preview and operation.
It enables efficient and convenient calibration of camera intrinsic and extrinsic parameters, meets the precision testing needs of industrial production and autonomous driving, and has high stability and reliability, adapting to different lighting and noise environments.
Smart Images

Figure CN121962292A_ABST
Abstract
Description
Camera calibration methods, devices, electronic equipment and storage media Technical Field
[0001] This disclosure relates to the field of machine vision technology, and in particular to a camera calibration method, apparatus, electronic device, and storage medium. Background Technology
[0002] In machine vision systems, precise camera calibration is crucial for ensuring measurement accuracy and image precision. The need for rapid, high-precision camera calibration is increasingly urgent in numerous fields, including industrial production, autonomous driving, and security monitoring.
[0003] Existing camera calibration methods suffer from numerous problems. For instance, the calibration process is complex and cumbersome, requiring a large number of calibration objects with stringent requirements on their placement and orientation. This not only consumes significant time and manpower but also makes the calibration accuracy susceptible to degradation due to minor placement errors in practice. Furthermore, some traditional algorithms are not accurate or stable enough in extracting features from the calibration images, and are easily affected by environmental factors such as lighting and noise, significantly compromising the reliability of the calibration results. Therefore, a new camera calibration technique is urgently needed to address the shortcomings of existing technologies. Summary of the Invention
[0004] In view of this, the present disclosure provides a camera calibration method, apparatus, electronic device, and storage medium.
[0005] According to a first aspect of this disclosure, a camera calibration method is provided, the method comprising: acquiring a checkerboard calibration board image captured by a camera under test, the surface of the checkerboard calibration board having a coded pattern; grayscale conversion of the checkerboard calibration board image to obtain a checkerboard calibration board grayscale image; obtaining corner features based on the checkerboard calibration board grayscale image, the corner features including image pixel coordinates and coordinates in the world coordinate system of each corner point on the checkerboard calibration board; and solving for the intrinsic and extrinsic parameters of the camera under test using the least squares method based on the corner features.
[0006] In some embodiments of the first aspect of this disclosure, the method further includes: during the process of the camera under test acquiring a checkerboard image, providing a human-computer interaction interface, and displaying the checkerboard calibration board image acquired by the camera under test in real time on the human-computer interaction interface in response to the user's calibration board image preview operation on the human-computer interaction interface.
[0007] In some embodiments of the first aspect of this disclosure, the method further includes: in response to a user's selection to save the currently displayed checkerboard calibration board image, storing the currently displayed checkerboard calibration board image to a designated storage space so as to use the checkerboard calibration board image stored in the designated storage space to perform calibration of the camera under test; and in response to a user's selection to delete the currently displayed checkerboard calibration board image, deleting the currently displayed checkerboard calibration board image.
[0008] In some embodiments of the first aspect of this disclosure, the method further includes: displaying the intrinsic and extrinsic parameters of the camera under test in real time on a human-computer interaction interface.
[0009] In some embodiments of the first aspect of this disclosure, the method further includes: in response to a user's save operation on the intrinsic and extrinsic parameters of the camera under test, saving the intrinsic and extrinsic parameters of the camera under test according to a file type selected by the user.
[0010] In some embodiments of the first aspect of this disclosure, the file type includes one of the following: XML, TXT, DOC.
[0011] According to a second aspect of this disclosure, a camera calibration apparatus is provided, comprising: an image acquisition unit for acquiring a checkerboard calibration board image captured by a camera under test, the surface of the checkerboard calibration board having a coded pattern; a grayscale processing unit for grayscale conversion of the checkerboard calibration board image to obtain a checkerboard calibration board grayscale image; a feature extraction unit for obtaining corner features based on the checkerboard calibration board grayscale image, the corner features including image pixel coordinates and coordinates in the world coordinate system of each corner point on the checkerboard calibration board; and a parameter solving unit for solving the intrinsic and extrinsic parameters of the camera under test using the least squares method based on the corner features.
[0012] In some embodiments of the second aspect of this disclosure, the camera calibration device further includes: a human-computer interaction unit, configured to provide a human-computer interaction interface during the process of the camera under test acquiring a checkerboard image, and to display the checkerboard calibration board image acquired by the camera under test in real time on the human-computer interaction interface in response to a user's selection and save operation on the calibration board image on the human-computer interaction interface; and / or, configured to store the currently displayed checkerboard calibration board image in a designated storage space in response to a user's selection and save operation on the currently displayed checkerboard calibration board image, so as to use the checkerboard calibration board image stored in the designated storage space to perform calibration of the camera under test; and to delete the currently displayed checkerboard calibration board image in response to a user's selection and delete operation on the currently displayed checkerboard calibration board image; and / or, configured to display the intrinsic and extrinsic parameters of the camera under test in real time on the human-computer interaction interface; and / or, configured to save the intrinsic and extrinsic parameters of the camera under test according to the file type selected by the user in response to a user's save operation on the intrinsic and extrinsic parameters of the camera under test.
[0013] According to a fourth aspect of this disclosure, an electronic device is provided, comprising: a memory storing a program, the program including instructions that, when executed by the processor, cause the processor to perform the camera calibration method described above.
[0014] According to a fourth aspect of this disclosure, a computer-readable storage medium storing a program is provided, the program including instructions that, when executed by a processor, cause the processor to perform the camera calibration method described above.
[0015] As can be seen from the above technical solutions, the embodiments of this disclosure can achieve efficient and convenient calibration of camera intrinsic and extrinsic parameters. The calibration accuracy can meet the application requirements of precision detection in industrial production and environmental perception in autonomous driving. At the same time, it can maintain high stability and reliability under different lighting conditions and a certain degree of noise. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 is a schematic diagram of the system architecture applicable to the embodiments of this disclosure; Figure 2 is a flowchart of the camera calibration method provided in the embodiments of this disclosure; Figure 3 is a structural schematic diagram of the camera calibration device provided in the embodiments of this disclosure; Figure 4 is a schematic block diagram of the electronic device provided in the embodiments of this disclosure. Detailed Implementation
[0018] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0019] The terminology used in the embodiments of this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of this disclosure. The singular forms “a,” “the,” and “the” as used in the embodiments of this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0020] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0021] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0022] Figure 1 shows a schematic diagram of the architecture of the system applicable to the embodiments of this disclosure. Referring to Figure 1, the system applicable to the embodiments of this disclosure may include: a checkerboard calibration board, a camera under test (DUT), and an electronic device. The DUT and the electronic device are communicatively connected. The checkerboard calibration board is arranged within the field of view of the DUT. The electronic device can be used to calibrate the intrinsic and extrinsic parameters of the DUT using the camera calibration method described in the embodiments of this disclosure.
[0023] Camera intrinsic parameters are inherent properties of the camera itself. They describe how a 3D point in the camera coordinate system is projected onto a 2D pixel coordinate on the image plane. In some examples, camera intrinsic parameters may include focal length, principal point coordinates, etc. In other examples, camera intrinsic parameters may include distortion coefficients in addition to focal length and principal point coordinates.
[0024] Focal length includes: the focal length along the x-axis of the image (in pixels) and the focal length along the y-axis of the image (in pixels). The focal length determines the camera's field of view (FOV) and the scaling ratio of 3D points to the image plane.
[0025] The principal point coordinates include the x-coordinate and y-coordinate of the image principal point in the pixel coordinate system. The principal point, i.e., the center point of the image, is the intersection of the optical axis and the image plane. Due to slight deviations in sensor installation, the actual principal point may be slightly offset from the geometric center of the image.
[0026] Distortion coefficients are a set of parameters that describe the optical distortion of a lens. Distortion coefficients can include radial distortion, barrel distortion, pincushion distortion, tangential distortion, etc. Radial distortion, caused by the lens shape, makes straight lines appear curved at the edges of the image.
[0027] Camera extrinsic parameters describe the rigid body transformation relationship between the world coordinate system and the camera coordinate system. These parameters can include a rotation matrix and a translation vector. The rotation matrix is a 3x3 orthogonal matrix that describes how the world coordinate system needs to be rotated to align with the camera coordinate system, containing camera orientation information including pitch, yaw, and roll. The translation vector is a 3x1 vector that describes the displacement from the world origin to the camera's optical center in the world coordinate system, i.e., the camera's position coordinates in the world.
[0028] In practical applications, camera intrinsic parameters can be used, but are not limited to, correcting image distortion, back-projecting two-dimensional pixels into three-dimensional rays in 3D reconstruction, and calculating true dimensions in visual measurements. Camera extrinsic parameters can be used, but are not limited to, locating the camera itself, determining the position of an object relative to the camera, and joint calibration of multi-camera systems.
[0029] Electronic devices can be implemented as, but are not limited to, computers, clients, servers, or other similar devices. The structure of an electronic device is shown in the relevant section of Figure 4 below, and will not be elaborated upon here.
[0030] Figure 2 shows a schematic flowchart of the camera calibration method provided in this embodiment of the present disclosure. Referring to Figure 2, the camera calibration method in this embodiment of the present disclosure may include: step 201, acquiring a checkerboard calibration board image captured by the camera under test, wherein the surface of the checkerboard calibration board has a coded pattern; step 202, grayscale conversion of the checkerboard calibration board image to obtain a grayscale image of the checkerboard calibration board; step 203, obtaining corner features based on the grayscale image of the checkerboard calibration board, wherein the corner features include the image pixel coordinates of each corner point on the checkerboard calibration board and its coordinates in the world coordinate system; step 204, solving for the intrinsic and extrinsic parameters of the camera under test using the least squares method based on the corner features.
[0031] In this embodiment of the disclosure, the surface of the checkerboard calibration plate has a coded pattern, which facilitates quick and accurate identification and positioning in an image. The coded image can be, but is not limited to, ArUco, AprilTag, or a custom binary code. Exemplarily, the coded pattern can be arranged around the perimeter or at specific locations inside the checkerboard calibration plate to uniquely identify the correspondence between the number and coordinates of each corner point, and can be arranged at the intersection points of the checkerboard grid on the calibration plate.
[0032] During calibration, the checkerboard calibration board can be placed within the field of view of the camera under test. By adjusting the position, angle, and distance of the checkerboard calibration board relative to the camera under test, the camera can acquire multiple images of the checkerboard calibration board from different perspectives. That is, the checkerboard calibration board images in step 201 include multiple images of the calibration board set at different positions, angles, and distances relative to the camera under test. Acquiring checkerboard calibration board images at different angles, positions, and distances ensures that the checkerboard calibration board in the images is clear, complete, and the coded pattern is identifiable, with uniform illumination, avoiding reflections or shadows.
[0033] In practical applications, the checkerboard calibration board can be placed within the camera's field of view, and the position, angle, and distance of the checkerboard calibration board relative to the camera under test can be changed according to predetermined rules to obtain multiple images of the checkerboard calibration board.
[0034] Furthermore, the method in this embodiment may further include: during the process of the camera under test acquiring a checkerboard image, providing a human-computer interaction interface, and displaying the checkerboard calibration board image acquired by the camera under test in real time on the human-computer interaction interface in response to the user's calibration board image preview operation on the human-computer interaction interface. Thus, the operator can view the checkerboard calibration board image in real time and intuitively through the preview function, ensuring that the acquired image is clear, complete, and has obvious features, and ensuring that the quality of the acquired checkerboard calibration board image meets the calibration requirements.
[0035] Furthermore, the method in this embodiment may further include: in response to a user's selection and save operation on the currently displayed checkerboard calibration board image, storing the currently displayed checkerboard calibration board image in a designated storage space, so as to use the checkerboard calibration board image stored in the designated storage space to perform the calibration of the camera under test, and subsequently, the checkerboard calibration board image can be read from the designated storage space to perform the processing of steps 202 to 204; in response to a user's selection and delete operation on the currently displayed checkerboard calibration board image, deleting the currently displayed checkerboard calibration board image. Thus, users can flexibly select checkerboard calibration board images to participate in camera calibration as needed, delete checkerboard calibration board images whose quality does not meet the calibration requirements while acquiring data, reduce storage space occupation, lower memory costs, and reduce the amount of data processed subsequently, further improving the efficiency of camera calibration.
[0036] In step 202, an image preprocessing algorithm can be used to convert the checkerboard calibration board image to grayscale to obtain a grayscale image of the checkerboard calibration board. This converts the color checkerboard calibration board image into a recovered image, reducing the amount of data while retaining sufficient feature information. This enhances image clarity and feature contrast while reducing computational complexity. The image preprocessing algorithm can be, but is not limited to, weighted methods, simple averaging methods, etc. That is, a weighted method or a simple averaging method can be used to convert the checkerboard calibration board image into a grayscale image of the checkerboard calibration board.
[0037] Furthermore, in step 202, histogram equalization and filtering operations can be performed on the grayscale image of the checkerboard calibration board to remove noise interference and improve the stability of subsequent corner detection. The filtering operation may include smoothing the grayscale image of the checkerboard calibration board using a Gaussian filtering algorithm. Thus, filtering algorithms can be used to remove noise from the image, further improving image quality.
[0038] In step 203, an improved corner detection algorithm can be used to extract corner features from the calibration board. Specifically, the improved corner detection algorithm can be used to extract corner features from the calibration board, and the corner coordinates can be accurately determined using sub-pixel localization technology. These corner coordinate data are then stored. Therefore, by combining the corner detection algorithm with sub-pixel localization technology, the coordinate positions of corner points can be accurately determined, resulting in higher accuracy and stability compared to traditional corner detection methods.
[0039] Specifically, the exemplary implementation process of step 203 may include the following steps a1 to a4: Step a1, locate the coded pattern area and the checkerboard area; taking advantage of the characteristics of the coded pattern, which usually has high contrast, closed boundaries and specific aspect ratio, candidate areas are quickly screened out by contour detection or connected component analysis, and perspective correction is performed on the candidate areas to transform them into front views for easy subsequent decoding.
[0040] Coarse localization of the checkerboard area: After removing the coded pattern area, the checkerboard area is preliminarily determined by using the periodic black and white alternation texture features of the checkerboard and detecting the main texture direction through directional gradient histogram analysis or Fourier transform.
[0041] Step a2: Decode the coded pattern and extract corner features; specifically, binarize and mesh each corrected coded pattern region, read the binary coded information, and decode it to obtain its unique ID. According to the predefined calibration board layout, this ID directly corresponds to the physical position of the coded pattern on the checkerboard calibration board, that is, the coordinates of the coded pattern in the world coordinate system.
[0042] The pixel coordinates of the four corners of the coded image region are determined using Harris corner detection or FAST corner detection combined with non-maximum suppression. This provides a high-quality initial estimate for subsequent subpixel thinning.
[0043] Step a3: Extract the corner points of the chessboard grid; for example, an iterative optimization algorithm that combines regional grayscale information with geometric constraints can be used to achieve corner point localization with sub-pixel accuracy.
[0044] Using the corner points of the decoded coded pattern as anchor points, and based on the known physical dimensions and number of rows and columns of the chessboard, the initial pixel positions of all internal chessboard corner points are predicted through perspective projection model or homography transformation.
[0045] For regions without adjacent coded patterns, most corners are detected using Shi-Tomasi corner detection or template matching methods. Then, a corner grid model is fitted using a random sampling consensus algorithm to remove outliers and fill in missing points. This corner grid model contains the initial pixel positions of all checkerboard corners.
[0046] Subpixel corner localization is typically based on gradients, assuming the corner is located at the intersection of edges. This disclosure introduces crosshair template matching and grayscale sum-of-squares minimization.
[0047] Specifically, a neighborhood window is selected centered on the initial pixel position of each corner point. Within this window, an ideal "X" or "+" shaped grayscale model for the corner point is defined, or known checkerboard edge direction information is utilized. The sub-pixel positions of the corner points are continuously adjusted using gradient descent or Gauss-Newton methods to minimize the difference (e.g., squared error) between the actual image grayscale within the neighborhood window and the ideal model. This process considers grayscale gradients in both the x and y directions and provides preliminary compensation for lens distortion, resulting in more stable convergence and stronger robustness to noise and blur.
[0048] During the optimization process, these constraints are incorporated into the objective function using weighted least squares to prevent the optimization from getting trapped in local extrema and to improve the regularity of the overall mesh.
[0049] Step a4: Establish the correspondence and obtain the corner features.
[0050] For corner points of the encoded image, the coordinates of the corner points in the world coordinate system are read directly from the pre-configured calibration board file based on the ID of the encoded pattern obtained from decoding.
[0051] For the corner points on the internal chessboard, using the corner points of the coded pattern as reference points, the coordinates of each corner point (i.e., sub-pixel corner point) in the world coordinate system are calculated by bilinear interpolation using the known physical spacing of the chessboard.
[0052] The homography transformation of the grid formed by all corner points in the image is calculated, and the world coordinates of the grid formed by all corner points are projected back to the image. If the reprojection error of a corner point (i.e., the difference between the subpixel coordinates and the projected coordinates) exceeds a preset threshold (e.g., 0.5 pixels), it is marked as a suspicious point. Suspicious points are then locally re-detected or corrected by weighted averaging of the positions of adjacent corner points to ensure that the world coordinates of all corner points are consistent and reliable.
[0053] The above process yields a set of coordinate point pairs, which include the image pixel coordinates of each corner point on the checkerboard calibration board and their coordinates in the world coordinate system. This set of coordinate point pairs provides a highly reliable data foundation for subsequent least-squares optimization to solve for camera parameters.
[0054] In step 203, sub-pixel localization technology improves the accuracy of corner coordinates from the pixel level to 0.1 pixels or even higher, fundamentally enhancing the accuracy of the calibration input. Combining grayscale information, geometric constraints, and global optimization makes it insensitive to image noise, uneven lighting, and slight motion blur, reducing false positives and false negatives. Furthermore, by using an coded pattern to provide absolute positional references, even if the checkerboard area is occluded or located at the image edge, the coordinates of all corner points can be accurately recovered, avoiding the error-prone corner sorting problem inherent in traditional checkerboard patterns.
[0055] In step 204, a mathematical model of camera imaging is established based on corner features, and the intrinsic and extrinsic parameters of the camera under test are optimized using the least squares method. Specifically, the established camera imaging mathematical model and the least squares-based optimization algorithm are used to solve for the camera's intrinsic and extrinsic parameters. During the solution process, prior knowledge is incorporated to constrain the parameters; for example, the parameter value ranges are set based on the approximate focal length range of the camera and its possible installation location, thereby accelerating the solution process and improving the accuracy of the results. The use of a least squares-based optimization strategy combined with prior knowledge to constrain the parameters during the solution process can further improve the accuracy and reliability of the calibration results.
[0056] Assume the world coordinate system uses the calibration plate plane as the XY plane, with Z=0. The camera coordinate system uses the camera optical center as the origin and the optical axis as the Z-axis. The pixel coordinate system uses the top-left corner of the image as the origin, with the u-axis pointing to the right and the v-axis pointing downwards. Assume N valid images are obtained as described above. The corner features of each image i can include the pixel coordinates of Mi corner points, where Mi is the number of corner points in image i. Simultaneously, the world coordinates of each corner point are known. Therefore, a corresponding dataset can be constructed using the corner features: {image i, corner point j, pixel coordinates, world coordinates}, i=1,2,…,N, j=1,2,…,Mi.
[0057] Specifically, a mathematical model of camera imaging can be constructed using a vacuum camera model, and this mathematical model of camera imaging can be expressed as follows:
[0058]
[0059]
[0060]
[0061] in, This represents the coordinates of the corner point in the world coordinate system. This represents the coordinates of the corner point in the camera coordinate system. This represents the coordinates of the corner point in the pixel coordinate system. Represents the normalized coordinates of the corner points. Represents the rotation matrix. This represents the translation vector. This represents the intrinsic parameter matrix of the camera. , Indicates focal length. , Indicates the coordinates of the principal point.
[0062] First, the corresponding dataset {image i, corner j, pixel coordinates, world coordinates} constructed using corner features is substituted into the aforementioned mathematical model to form a system of equations to solve for the camera intrinsic and extrinsic parameters. Then, based on the solved camera intrinsic and extrinsic parameters, the least squares method is used for iterative optimization with the objective function of minimizing the reprojection error, thereby obtaining the optimized camera intrinsic and extrinsic parameters. These optimized camera intrinsic and extrinsic parameters are the final parameters.
[0063] The objective function, minimizing the reprojection error, can be expressed as follows:
[0064] in, These are the actual pixel coordinates of the j-th corner point in the i-th image. Indicates passing through the current parameter Predicted pixel coordinates calculated from the world coordinates of the corner point. Current parameters. This represents the camera intrinsic and extrinsic parameters used in the current round of the least squares-based iterative optimization. The camera intrinsic and extrinsic parameters used in the current round are the same as those obtained in the previous round.
[0065] Furthermore, the method in this embodiment may further include: in response to a user's save operation of the intrinsic and extrinsic parameters of the camera under test, saving the intrinsic and extrinsic parameters of the camera under test according to a file type selected by the user. The file type may include, but is not limited to, one of the following: XML, TXT, or DOC. Thus, the calibrated camera parameters can be displayed on the screen through a parameter output and display module, allowing the operator to intuitively view the calibration results and save them as files in a specific format, such as XML or TXT files, so that these parameters can be directly called in subsequent machine vision applications to achieve precise calibration of the CCD camera and accurate image correction.
[0066] In practical applications, adjustments and optimizations can be made according to different camera models and application scenarios. For example, for CCD cameras with different resolutions and optical characteristics, the parameters in the image preprocessing algorithm and the threshold of the corner detection algorithm can be adjusted to suit their characteristics.
[0067] Furthermore, in industrial testing scenarios where high precision is required, the number of chessboard calibration board images acquired and the range of angle changes can be increased in step 201 to further improve calibration accuracy.
[0068] The embodiments disclosed herein have the following beneficial effects: 1) High-precision calibration: The improved corner detection algorithm and optimized parameter solving strategy significantly improve the accuracy of camera calibration, which can meet the needs of high-precision measurement and image analysis, and provide reliable technical support for applications such as precision detection in industrial production and environmental perception in autonomous driving.
[0069] 2) High efficiency and convenience: The use of a checkerboard calibration board and a relatively simplified calibration process reduces the time and manpower costs required for calibration. Operators do not need to have in-depth professional knowledge and complex operating skills to quickly complete the camera calibration work, thus improving work efficiency.
[0070] 3) High stability: The image preprocessing algorithm effectively reduces the impact of environmental factors on the calibration results, enabling the calibration method to maintain high stability and reliability under different lighting conditions and a certain degree of noise, thus broadening its application scope.
[0071] Figure 3 shows a schematic diagram of the camera calibration device provided in an embodiment of this disclosure. Referring to Figure 3, the camera calibration device 300 of this embodiment may include: an image acquisition unit 301, used to acquire an image of a checkerboard calibration board captured by the camera under test, the surface of the checkerboard calibration board having a coded pattern; a grayscale processing unit 302, used to grayscale the checkerboard calibration board image to obtain a grayscale image of the checkerboard calibration board; a feature extraction unit 303, used to obtain corner features based on the grayscale image of the checkerboard calibration board, the corner features including the image pixel coordinates of each corner point on the checkerboard calibration board and its coordinates in the world coordinate system; and a parameter solving unit 304, used to solve for the intrinsic and extrinsic parameters of the camera under test using the least squares method based on the corner features.
[0072] Furthermore, the camera calibration device 300 may also include: a human-computer interaction unit 305, used to provide a human-computer interaction interface during the process of the camera under test acquiring checkerboard images, and to display the checkerboard calibration board image acquired by the camera under test in real time on the human-computer interaction interface in response to the user's operation of previewing the calibration board image on the human-computer interaction interface; and / or, used to store the currently displayed checkerboard calibration board image to a specified storage space in response to the user's selection and save operation of the currently displayed checkerboard calibration board image, so as to use the checkerboard calibration board image stored in the specified storage space to perform the calibration of the camera under test; to delete the currently displayed checkerboard calibration board image in response to the user's selection and delete operation of the currently displayed checkerboard calibration board image; and / or, used to display the intrinsic and extrinsic parameters of the camera under test in real time on the human-computer interaction interface; and / or, used to save the intrinsic and extrinsic parameters of the camera under test according to the file type selected by the user in response to the user's operation of saving the intrinsic and extrinsic parameters of the camera under test.
[0073] In practical applications, the camera calibration device 300 can be implemented through software, hardware, or a combination of both. For example, the camera calibration device 300 can be implemented as software running in the electronic device 400 described below.
[0074] Figure 4 shows a schematic structural diagram of an electronic device provided in an embodiment of this disclosure. Referring to Figure 4, the electronic device 400 provided in an embodiment of this disclosure may include: one or more processors 401 and a memory 402. The memory 402 stores a computer program, which, when executed by the one or more processors 401, causes the processors 401 to perform the aforementioned camera calibration method.
[0075] Processor 401 may be, but is not limited to, a central processing unit (CPU), a graphics processing unit (GPU), or other processing units with data processing capabilities and / or instruction execution capabilities.
[0076] Memory 402 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor may execute the program instructions to implement the methods described above and / or other desired functions.
[0077] Depending on the specific application, the electronic device 400 may also include any other suitable components.
[0078] In addition to the methods and devices described above, embodiments of this disclosure may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the camera calibration method described above.
[0079] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0080] Furthermore, embodiments of this disclosure also provide a computer-readable storage medium having a computer program stored thereon, which, when run by a processor, causes the processor to perform the steps in the camera calibration method described above.
[0081] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.
[0082] The technical solutions provided in this disclosure have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this disclosure. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of this disclosure. Furthermore, those skilled in the art will recognize that, based on the ideas of this disclosure, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this disclosure.
[0083] The above description is merely a preferred embodiment of this disclosure and is not intended to limit this disclosure. Any modifications or equivalent substitutions made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A camera calibration method, characterized in that, The method includes: acquiring a checkerboard calibration board image captured by a camera under test, the surface of the checkerboard calibration board having a coded pattern; grayscale conversion of the checkerboard calibration board image to obtain a checkerboard calibration board grayscale image; obtaining corner features based on the checkerboard calibration board grayscale image, the corner features including the image pixel coordinates and their coordinates in the world coordinate system of each corner point on the checkerboard calibration board; and solving for the intrinsic and extrinsic parameters of the camera under test using the least squares method based on the corner features.
2. The method according to claim 1, characterized in that, The method further includes: during the process of the camera under test acquiring the checkerboard image, a human-computer interaction interface is provided, and in response to the user's calibration board image preview operation on the human-computer interaction interface, the checkerboard calibration board image acquired by the camera under test is displayed in real time on the human-computer interaction interface.
3. The method according to claim 2, characterized in that, The method further includes: in response to a user's selection to save the currently displayed checkerboard calibration board image, storing the currently displayed checkerboard calibration board image to a designated storage space so as to use the checkerboard calibration board image stored in the designated storage space to perform calibration of the camera under test; and in response to a user's selection to delete the currently displayed checkerboard calibration board image, deleting the currently displayed checkerboard calibration board image.
4. The method according to claim 1 or 2, characterized in that, The method further includes: displaying the intrinsic and extrinsic parameters of the camera under test in real time on a human-computer interaction interface.
5. The method according to claim 4, characterized in that, The method further includes: in response to the user's save operation on the intrinsic and extrinsic parameters of the camera under test, saving the intrinsic and extrinsic parameters of the camera under test according to the file type selected by the user.
6. The method according to claim 1 or 5, characterized in that, The file types include one of the following: XML, TXT, DOC.
7. A camera calibration device, characterized in that, The camera calibration device includes: an image acquisition unit for acquiring an image of a checkerboard calibration board captured by the camera under test, the surface of which has a coded pattern; a grayscale processing unit for converting the checkerboard calibration board image to grayscale to obtain a grayscale image of the checkerboard calibration board; a feature extraction unit for obtaining corner features based on the grayscale image of the checkerboard calibration board, the corner features including the image pixel coordinates and their coordinates in the world coordinate system of each corner point on the checkerboard calibration board; and a parameter solving unit for solving the intrinsic and extrinsic parameters of the camera under test using the least squares method based on the corner features.
8. The apparatus according to claim 7, characterized in that, The camera calibration device further includes: a human-computer interaction unit, used to provide a human-computer interaction interface during the process of the camera under test acquiring checkerboard images, and to display the checkerboard calibration board image acquired by the camera under test in real time on the human-computer interaction interface in response to the user's operation of previewing the calibration board image on the human-computer interaction interface; and / or, used to store the currently displayed checkerboard calibration board image to a designated storage space in response to the user's selection and save operation on the currently displayed checkerboard calibration board image, so as to use the checkerboard calibration board image stored in the designated storage space to perform the calibration of the camera under test; and to delete the currently displayed checkerboard calibration board image in response to the user's selection and delete operation on the currently displayed checkerboard calibration board image; and / or, used to display the intrinsic and extrinsic parameters of the camera under test in real time on the human-computer interaction interface; and / or, used to save the intrinsic and extrinsic parameters of the camera under test according to the file type selected by the user in response to the user's operation of saving the intrinsic and extrinsic parameters of the camera under test.
9. An electronic device, characterized in that, include: A memory storing a program, the program comprising instructions that, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 6.
10. A computer-readable storage medium storing a program, the program comprising instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 6.