A camera calibration method, electronic device and storage medium

By using pairs of parallel lines in three-dimensional space as calibration objects in camera calibration, the direction vector is obtained to calculate camera transformation parameters. This solves the problem of low calibration accuracy caused by relying on calibration plates in existing technologies, and achieves higher precision and more flexible camera calibration.

CN116128970BActive Publication Date: 2026-01-30ZHEJIANG LEAPMOTOR TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211512745.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-28
Publication Date
2026-01-30
Estimated Expiration
2042-11-28

AI Technical Summary

Technical Problem

Existing camera calibration methods rely on calibration boards, which are easily affected by lighting and angle, resulting in low accuracy of calibration results.

Method used

By directly using the pairs of parallel straight lines in three-dimensional space captured by the reference camera and the camera to be calibrated, the direction vector of the straight line calibration object is obtained, and the transformation parameters between the cameras are calculated.

Benefits of technology

It overcomes the dependence on calibration boards, improves calibration accuracy and flexibility, reduces calibration costs, is suitable for indoor and outdoor scenarios, and avoids error accumulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116128970B_ABST
    Figure CN116128970B_ABST
Patent Text Reader

Abstract

This application discloses a camera calibration method, electronic device, and storage medium. The method includes: obtaining straight line calibration objects from a reference image and a calibration image, respectively; wherein the straight line calibration objects are at least one pair of parallel straight lines in three-dimensional space, the reference image is captured by a reference camera, and the calibration image is captured by a camera to be calibrated; obtaining a first direction vector of the straight line calibration objects in the reference image, and obtaining a second direction vector of the straight line calibration objects in the calibration image; and obtaining transformation parameters between the reference camera and the camera to be calibrated based on the first direction vector and the second direction vector. Through this method, this application overcomes the problem that existing camera calibration methods must rely on a calibration board, directly using the straight line pairs captured by the reference camera and the camera to be calibrated to determine the transformation parameters between the reference camera and the camera to be calibrated, thereby achieving the calibration of the camera to be calibrated.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer vision, in particular to a camera calibration method, an electronic device and a storage medium. BACKGROUND

[0002] In a scene requiring the application of a camera, such as various industrial robots, sweeping robots, autonomous vehicles, etc., multiple cameras at different positions are often installed to enhance the perception ability of the environment. Since the spatial transformation between multiple camera coordinate systems can be used to fuse the perception results of each camera, it is crucial to determine the spatial transformation parameters between the cameras.

[0003] In the prior art, a calibration board is often used as a calibration object to calibrate the camera. In order to detect the calibration board, the calibration board must be large enough and close enough to the camera, and the calibration board must be located in the common field of view of the reference camera and the camera to be calibrated. However, the image detection of the calibration board is easily affected by light, angle, etc., resulting in low accuracy of the calibration result. SUMMARY

[0004] The technical problem solved by the present application is to provide a camera calibration method, an electronic device and a storage medium, which can overcome the problem that the existing camera calibration method must rely on a calibration board, and directly use the straight lines captured by the reference camera and the camera to be calibrated to determine the transformation parameters between the reference camera and the camera to be calibrated, thereby realizing the calibration of the camera to be calibrated.

[0005] To solve the above technical problem, the first aspect of the present application provides a camera calibration method, which comprises: acquiring a straight line calibration object from a reference image and a to-be-calibrated image respectively; wherein the straight line calibration object is at least one group of mutually parallel straight line pairs in a three-dimensional space, the reference image is captured by a reference camera, and the to-be-calibrated image is captured by a to-be-calibrated camera; acquiring a first direction vector of the straight line calibration object in the reference image, and acquiring a second direction vector of the straight line calibration object in the to-be-calibrated image; and based on the first direction vector and the second direction vector, obtaining the transformation parameters between the reference camera and the to-be-calibrated camera.

[0006] Wherein, acquiring the first direction vector of the straight line calibration object in the reference image, or acquiring the second direction vector of the straight line calibration object in the to-be-calibrated image, comprises: acquiring a straight line equation of each straight line in the straight line calibration object in the image where the straight line calibration object is located; determining a normal vector corresponding to each straight line based on the straight line equation of each straight line; wherein the normal vector corresponding to the straight line is the normal vector of the plane formed by the straight line and the optical center of the target camera, and the target camera is the camera that captures the image where the straight line calibration object is located; and obtaining a direction vector corresponding to the straight line calibration object based on the normal vector corresponding to each straight line.

[0007] The method further includes: determining a normal vector corresponding to each straight line based on a straight line equation of each straight line, including: multiplying the straight line equation of each straight line with a transpose matrix of an intrinsic matrix of the target camera respectively to obtain the normal vector corresponding to each straight line.

[0008] The method further includes: obtaining a direction vector corresponding to the straight line calibration object based on the normal vector corresponding to each straight line, including: performing cross multiplication on the normal vector corresponding to each straight line to obtain the direction vector corresponding to the straight line calibration object.

[0009] The method further includes: obtaining a straight line equation of each straight line in the straight line calibration object in an image in which the straight line calibration object is located, including: selecting at least two pixel points on each straight line in the straight line calibration object in the image in which the straight line calibration object is located; and obtaining the straight line equation of the straight line based on coordinates of the at least two pixel points on the straight line.

[0010] The method further includes: obtaining the straight line equation of the straight line based on the coordinates of the at least two pixel points on the straight line, including: performing cross multiplication on the homogeneous coordinates of the at least two pixel points to obtain the straight line equation of the straight line; wherein the homogeneous coordinates of the at least two pixel points are obtained after distortion correction of the pixel points.

[0011] The method further includes: after obtaining the first direction vector of the straight line calibration object in the reference image and obtaining the second direction vector of the straight line calibration object in the to-be-calibrated image, performing normalization processing on the first direction vector and the second direction vector respectively to obtain a first normalized direction vector and a second normalized direction vector.

[0012] The method further includes: obtaining the transformation parameter between the reference camera and the to-be-calibrated camera based on the first normalized direction vector and the second normalized direction vector.

[0013] The method further includes: before obtaining the straight line calibration object from the reference image and the to-be-calibrated image respectively, detecting all straight lines in the reference image and the to-be-calibrated image; and obtaining a straight line pair that meets a preset condition in the reference image and the to-be-calibrated image respectively as the straight line calibration object.

[0014] The preset condition is that the straight line pair is a pair of mutually parallel straight lines that are farthest apart in the image, or an area included in the straight line pair is largest in the image, the area included in the straight line pair being an area between the two mutually parallel straight lines included in the straight line pair.

[0015] To solve the above technical problems, a second aspect of the present application provides an electronic device, which includes a memory and a processor coupled with each other, the memory stores program instructions, and the processor is configured to execute the program instructions stored in the memory to implement the method provided in the first aspect.

[0016] To solve the above technical problems, the third aspect of the present application provides a computer readable storage medium for storing program instructions, which can be executed by a processor to implement the method provided in the first aspect.

[0017] The beneficial effects of the present application are: different from the prior art, the present application takes at least one set of parallel straight lines in three-dimensional space as a straight line calibration object, first obtains the straight line calibration object from the reference image and the to-be-calibrated image respectively, the reference image is obtained by a reference camera, and the to-be-calibrated image is obtained by a to-be-calibrated camera; then a first direction vector of the straight line calibration object in the reference image is obtained, and a second direction vector of the straight line calibration object in the to-be-calibrated image is obtained; based on the first direction vector and the second direction vector, the transformation parameters between the reference camera and the to-be-calibrated camera can be obtained. Since there are straight lines indoors or outdoors, by taking a pair of parallel straight lines as a straight line calibration object for camera calibration, the problem that the existing camera calibration method must rely on a calibration board can be overcome, the transformation parameters between the reference camera and the to-be-calibrated camera are directly determined by using the straight line pair photographed by the reference camera and the to-be-calibrated camera, and then the calibration of the to-be-calibrated camera is realized. BRIEF DESCRIPTION OF DRAWINGS

[0018] Figure 1 is a flowchart of the first embodiment of the camera calibration method provided by the present application;

[0019] Figure 2 is a flowchart of the second embodiment of the camera calibration method provided by the present application;

[0020] Figure 3 is a flowchart of the third embodiment of the camera calibration method provided by the present application;

[0021] Figure 4 is a schematic diagram of the first embodiment of the straight line calibration object selection method provided by the present application;

[0022] Figure 5 is a schematic diagram of the first embodiment of the electronic device provided by the present application;

[0023] Figure 6 is a schematic diagram of the first embodiment of the computer readable storage medium provided by the present application. DETAILED DESCRIPTION

[0024] With reference to the drawings and embodiments of the present application, the technical solutions in the embodiments of the present application are clearly and completely described. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of the present application.

[0025] It should be noted that the present application has a description of "first", "second" and the like. The "first", "second" and the like are only for the purpose of description, and cannot be understood as indicating or implying the relative importance of the indicated technical features or implicitly indicating the number of the indicated technical features. Therefore, the features with "first", "second" can explicitly or implicitly include at least one of the features.

[0026] In this document, reference to "embodiment" means that the specific feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The phrase appears at various places in the specification does not necessarily all refer to the same embodiment, nor is it necessary that every embodiment include the same features. It will be apparent to those skilled in the art from this disclosure that the embodiments described herein can be combined with other embodiments.

[0027] Please refer to Figure 1 , Figure 1 is a flowchart of a first embodiment of a camera calibration method provided by the present application. The method comprises:

[0028] S11: Obtain a straight line calibration object from a reference image and a to-be-calibrated image, respectively.

[0029] In an embodiment, the straight line calibration object is at least one set of parallel straight line pairs in a three-dimensional space. The two straight lines in the straight line pair can be in the same plane or not in the same plane. For example, one straight line is on the ground, and the other straight line is on the wall perpendicular to the ground, but the two straight lines should be parallel in the three-dimensional space. Further, the two straight lines can be straight lines of any color and thickness, for example, the straight lines can be lane lines, laser lines drawn by a laser, straight lines drawn on a wall by a person, etc.

[0030] Both the reference image and the image to be calibrated should contain at least one pair of parallel lines. If the reference image and the image to be calibrated contain only one pair of parallel lines, then that pair of parallel lines should be used directly as the line calibration object. If the reference image and the image to be calibrated contain multiple pairs of parallel lines, then the pair of lines that meets the preset conditions can be selected as the line calibration object. The preset conditions can be that the pair of lines is the two parallel lines that are furthest apart in the reference image or the image to be calibrated, or that the area contained in the pair of lines occupies the largest area in the reference image or the image to be calibrated. The area contained in the pair of lines is the area between the two parallel lines contained in the pair of lines. The reference image is captured by a reference camera, and the image to be calibrated is captured by a camera to be calibrated. At least one pair of parallel lines in the reference image and the image to be calibrated may be the same or different. If at least one pair of parallel lines in the reference image and the image to be calibrated are the same, it means that there is an identical region in the reference image and the image to be calibrated, that is, the reference camera and the camera to be calibrated share a common field of view. If at least one pair of parallel lines in the reference image and the image to be calibrated are different, it means that there is a different region in the reference image and the image to be calibrated, that is, the reference camera and the camera to be calibrated do not share a common field of view.

[0031] S12: Obtain the first direction vector of the straight line calibration object in the reference image, and obtain the second direction vector of the straight line calibration object in the image to be calibrated.

[0032] In one embodiment, the equation of each straight line in the line calibration object can be obtained in the image where the line calibration object is located. Specifically, for each straight line in the line calibration object, at least two pixels on the line are selected from the image where the line calibration object is located; the equation of the line is obtained based on the coordinates of the at least two pixels on the line. That is, for each straight line in the first line calibration object in the reference image, at least two pixels on the line are selected from the reference image, and the equation of the line is obtained using the coordinates of the at least two pixels; for each straight line in the second line calibration object in the image to be calibrated, at least two pixels on the line are selected from the image to be calibrated, and the equation of the line is obtained using the coordinates of the at least two pixels. Obtaining the equation of the line based on the coordinates of the at least two pixels includes: performing a cross product using the homogeneous coordinates of the at least two pixels to obtain the equation of the line; the homogeneous coordinates of the at least two pixels are obtained after distortion correction of the pixels, for example, points... The corresponding homogeneous coordinates are

[0033] Specifically, taking line A in the line calibration object in the reference image as an example, in one specific embodiment, two pixels on line A, namely p1 and p2, can be selected from the reference image. Then, the equation of line A is L1 = p1 × p2. Similarly, the equation of line B in the line calibration object in the reference image, L2, and the equation of each line in the line calibration object in the image to be calibrated can all be calculated in the same way. In this embodiment, two pixels on the line are selected to calculate the line equation. It can be understood that in other embodiments, three or four pixels on the line can also be selected to calculate the line equation; no specific limitation is made here.

[0034] After obtaining the equations of each line in the calibration object within the image containing the calibration object, the normal vector corresponding to each line is determined based on its equation. The normal vector is the normal vector of the plane formed by the line and the optical center of the target camera, which is the camera that captured the image of the calibration object. Specifically, the normal vector for each line can be obtained by multiplying its equation by the transpose of the target camera's intrinsic parameter matrix. For example, if the intrinsic parameter matrix of the reference camera is K, then the normal vector n1 corresponding to line A in the calibration object in the reference image is K. T L1, similarly, the normal vector n2 = K corresponding to line A in the reference image's line calibration object. T L2; The normal vector corresponding to each straight line in the calibration object in the image to be calibrated is obtained by multiplying the transpose of the intrinsic parameter matrix of the camera to be calibrated with the equation of the straight line in the calibration object in the image to be calibrated.

[0035] Finally, based on the normal vector corresponding to each line, the direction vector corresponding to the line calibration object is obtained. Specifically, the cross product of the normal vectors corresponding to each line is performed to obtain the direction vector corresponding to the line calibration object. Taking the line calibration object in the reference image as an example, the first direction vector d1 corresponding to the line calibration object in the reference image is d1 = n1 × n2. Similarly, the second direction vector d2 corresponding to the line calibration object in the image to be calibrated can be obtained by performing the cross product of the normal vectors corresponding to each line in the line calibration object in the image to be calibrated.

[0036] S13: Based on the first direction vector and the second direction vector, obtain the transformation parameters between the reference camera and the camera to be calibrated.

[0037] In one embodiment, since the straight line calibration objects in the reference image and the straight line calibration objects in the image to be calibrated are parallel to each other in three-dimensional space, d2 can be set to R. 21 d1, where R 21These are the transformation parameters between the reference camera and the camera to be calibrated. After obtaining the first direction vector and the second direction vector, the transformation parameters between the reference camera and the camera to be calibrated can be obtained.

[0038] In another embodiment, after obtaining the first direction vector d1 of the straight line calibration object in the reference image and the second direction vector d2 of the straight line calibration object in the image to be calibrated, the first direction vector and the second direction vector can be normalized to obtain the normalized first normalized direction vector and the second normalized direction vector. Based on the first normalized direction vector and the second normalized direction vector, the transformation parameters between the reference camera and the camera to be calibrated are obtained.

[0039] In this embodiment, R 21 Specifically, the rotational transformation parameters between the reference camera and the camera to be calibrated are used. Since the mounting positions of each camera relative to the carrier are fixed and known at the factory, the installation process does not significantly affect the translational transformations between the camera coordinate systems. Generally, only the rotational transformations between the camera coordinate systems are significantly affected. Therefore, only the rotation needs to be calibrated. The above camera calibration method can be performed not only when the camera leaves the factory but also after the camera has left the factory.

[0040] If there are multiple cameras, any one of them can be selected as the reference camera, and the other cameras can be used as the cameras to be calibrated. The transformation parameters from the reference camera to all the cameras to be calibrated can be obtained by the above method. Obviously, the above method does not require pairwise rotation transformation between adjacent cameras with a common field of view, which can avoid error accumulation and improve calibration accuracy.

[0041] The above method uses at least one pair of parallel straight lines in three-dimensional space as line calibration objects. First, the line calibration objects are obtained from a reference image (captured by a reference camera) and the image to be calibrated (captured by the camera to be calibrated). Then, the first direction vector of the line calibration objects in the reference image and the second direction vector of the line calibration objects in the image to be calibrated are obtained. Based on the first and second direction vectors, the transformation parameters between the reference camera and the camera to be calibrated can be obtained. Since straight lines exist both indoors and outdoors, using pairs of parallel straight lines as line calibration objects for camera calibration overcomes the problem of existing camera calibration methods relying on calibration boards. The transformation parameters between the reference camera and the camera to be calibrated are directly determined using the pair of straight lines captured by the reference camera and the camera to be calibrated, thus achieving the calibration of the camera to be calibrated.

[0042] Please see Figure 2 , Figure 2 This is a flowchart illustrating the second embodiment of the camera calibration method provided in this application. The method includes:

[0043] S21: Obtain the straight line calibration object from the reference image and the image to be calibrated, respectively.

[0044] Among them, the straight line calibration object is at least one pair of mutually parallel straight lines in three-dimensional space, the reference image is obtained by the reference camera, and the image to be calibrated is obtained by the camera to be calibrated.

[0045] S22: Obtain the first direction vector of the straight line calibration object in the reference image, and obtain the second direction vector of the straight line calibration object in the image to be calibrated.

[0046] For the specific implementation of steps S21 and S22, please refer to steps S11 and S12 of the first embodiment of the camera calibration method provided in this application, which will not be repeated here.

[0047] S23: Normalize the first direction vector and the second direction vector respectively to obtain the first normalized direction vector and the second normalized direction vector.

[0048] In this embodiment, after obtaining the first direction vector of the straight line calibration object in the reference image, the first direction vector can be normalized. Specifically, the first direction vector can be divided by its norm to obtain the first normalized direction vector, i.e., the first normalized direction vector. Similarly, after obtaining the second direction vector of the straight line calibration object in the image to be calibrated, the second normalized direction vector m2 can be obtained in the same way, which will not be elaborated here.

[0049] S24: Based on the first normalized direction vector and the second normalized direction vector, obtain the transformation parameters between the reference camera and the camera to be calibrated.

[0050] In one embodiment, the second normalized direction vector can be made equal to the product of the first normalized direction vector and the transformation parameters between the reference camera and the camera to be calibrated, i.e., let m2 = R. 21 m1, where R 21 The transformation parameters between the reference camera and the camera to be calibrated are obtained by acquiring the first normalized direction vector and the second normalized direction vector.

[0051] Please refer to the following: Figure 3 and Figure 4 , Figure 3 This is a flowchart illustrating the second embodiment of the camera calibration method provided in this application. Figure 4 This is a schematic diagram of one embodiment of the linear calibration object selection method provided in this application; the method includes:

[0052] S31: Detect all straight lines in the reference image and the image to be calibrated.

[0053] In one embodiment, for outdoor scenes, common lane detection methods (such as deep learning-based lane detection, threshold segmentation and edge detection-based lane detection, etc.) can be used to detect all straight lines in the reference image and the image to be calibrated; for indoor scenes, methods based on threshold segmentation and edge detection can be used to detect all straight lines in the reference image and the image to be calibrated. In other embodiments, straight lines can also be manually selected in the reference image and the image to be calibrated.

[0054] The straight line can be a lane line, a straight line on the ground or wall, a straight line projected by a laser, etc., and there are no restrictions here.

[0055] S32: Obtain pairs of straight lines that meet the preset conditions in the reference image and the image to be calibrated, respectively, and use them as straight line calibration objects.

[0056] In one embodiment, the preset conditions may include the line pair being the two most distant parallel lines in the image, or the area encompassed by the line pair occupying the largest area in the image, wherein the area encompassed by the line pair is the region between the two parallel lines contained in the line pair. Figure 4 As shown, when there is in the image Figure 4 In the two situations shown, the one that satisfies the condition should be selected. Figure 4 The two straight lines shown on the right serve as line calibration objects. In other embodiments, the user may also manually select a pair of straight lines as line calibration objects according to the actual situation; the selection of line calibration objects is not specifically limited here.

[0057] S33: Obtain the straight line calibration object from the reference image and the image to be calibrated, respectively.

[0058] S34: Obtain the first direction vector of the straight line calibration object in the reference image, and obtain the second direction vector of the straight line calibration object in the image to be calibrated.

[0059] For details on the specific implementation of steps S33 and S34, please refer to steps S11 and S12 of the first embodiment of the camera calibration method provided in this application, which will not be repeated here.

[0060] S35: Based on the first direction vector and the second direction vector, obtain the transformation parameters between the reference camera and the camera to be calibrated.

[0061] In one embodiment, since the straight line calibration objects in the reference image and the straight line calibration objects in the image to be calibrated are parallel to each other in three-dimensional space, the second direction vector is equal to the first direction vector multiplied by the transformation parameters between the reference camera and the camera to be calibrated. After obtaining the first direction vector and the second direction vector, the transformation parameters between the reference camera and the camera to be calibrated can be obtained.

[0062] In other embodiments, after obtaining the first direction vector and the second direction vector, the first direction vector and the second direction vector can be normalized to obtain normalized first direction vector and normalized second direction vector. Based on the normalized first direction vector and normalized second direction vector, the transformation parameters between the reference camera and the camera to be calibrated are obtained. For the specific process of this embodiment, please refer to steps S23 and S24 of the second embodiment of the camera calibration method provided in this application, which will not be repeated here.

[0063] In this embodiment, the calibration objects can be multiple parallel straight lines in three-dimensional space, ensuring that two arbitrary cameras can still be calibrated even if they do not share a common field of view (i.e., they cannot see the same two straight lines), thus obtaining the rotational transformation between the coordinate systems of the two cameras. Compared to existing methods that use calibration plates for camera calibration, this application greatly improves the flexibility of calibration object selection, helps reduce calibration costs, and overcomes the limitations of calibration objects and calibration stations in the prior art. Furthermore, this application can obtain the transformation parameters between all cameras to be calibrated and the reference camera without relying on pairwise rotational transformations between two cameras with a common field of view, avoiding error accumulation and improving calibration accuracy. Finally, since suitable straight lines exist both indoors and outdoors as calibration objects, the camera calibration method provided by this application can be used both when the camera leaves the factory and after the camera leaves the factory, making it widely applicable.

[0064] Please see Figure 5 , Figure 5 This is a schematic diagram of one embodiment of the electronic device provided in this application.

[0065] The electronic device 50 includes a memory 51 and a processor 52 coupled to each other. The memory 51 stores program instructions, and the processor 52 executes the program instructions stored in the memory 51 to implement the steps of any of the above-described method embodiments. In a specific implementation scenario, the electronic device 50 may include, but is not limited to, a microcomputer or a server. In addition, the electronic device 50 may also include mobile devices such as laptops and tablets, which are not limited here.

[0066] Specifically, processor 52 controls itself and memory 51 to implement the steps of any of the above-described organizational structure construction methods. Processor 52 can also be called a CPU (Central Processing Unit). Processor 52 may be an integrated circuit chip with signal processing capabilities. Processor 52 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 52 can be implemented using integrated circuit chips.

[0067] Please see Figure 6 , Figure 6 This is a schematic diagram of a framework of one embodiment of the computer-readable storage medium provided in this application.

[0068] The computer-readable storage medium 60 stores program instructions 61, which, when executed by a processor, are used to implement the steps in any of the above method embodiments.

[0069] The computer-readable storage medium 60 can specifically be a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or a medium that can store computer programs. Alternatively, it can be a server that stores the computer program, which can send the stored computer program to other devices for execution or can also run the stored computer program itself.

[0070] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the user through pop-up information or by asking the user to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.

[0071] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A camera calibration method, characterized by, The method comprises the following steps: obtaining a straight line calibration object from a reference image and a to-be-calibrated image respectively; wherein the straight line calibration object is at least one set of parallel straight line pairs in a three-dimensional space, the reference image is obtained by a reference camera, and the to-be-calibrated image is obtained by a to-be-calibrated camera; obtaining a first direction vector of the straight line calibration object in the reference image, and obtaining a second direction vector of the straight line calibration object in the to-be-calibrated image; normalizing the first direction vector and the second direction vector respectively, to obtain a first normalized direction vector and a second normalized direction vector; obtaining a transformation parameter between the reference camera and the to-be-calibrated camera based on the first normalized direction vector and the second normalized direction vector.

2. The method of claim 1, wherein, The step of obtaining the first direction vector of the straight line calibration object in the reference image, or the step of obtaining the second direction vector of the straight line calibration object in the to-be-calibrated image, comprises the following steps: obtaining a straight line equation of each straight line in the straight line calibration object in the image where the straight line calibration object is located; determining a normal vector corresponding to each straight line based on the straight line equation of each straight line; wherein the normal vector corresponding to each straight line is a normal vector of a plane formed by the straight line and an optical center of a target camera, and the target camera is a camera for shooting the image where the straight line calibration object is located; obtaining a direction vector corresponding to the straight line calibration object based on the normal vector corresponding to each straight line.

3. The method of claim 2, wherein, The step of determining the normal vector corresponding to each straight line based on the straight line equation of each straight line comprises the following steps: multiplying the straight line equation of each straight line and a transpose matrix of an intrinsic matrix of the target camera respectively to obtain the normal vector corresponding to each straight line; and / or, the step of obtaining the direction vector corresponding to the straight line calibration object based on the normal vector corresponding to each straight line comprises the following step: cross-multiplying the normal vector corresponding to each straight line to obtain the direction vector corresponding to the straight line calibration object.

4. The method of claim 2, wherein, The step of obtaining the straight line equation of each straight line in the straight line calibration object in the image where the straight line calibration object is located comprises the following steps: for each straight line in the straight line calibration object, selecting at least two pixel points on the straight line in the image where the straight line calibration object is located; obtaining the straight line equation of the straight line based on the coordinates of the at least two pixel points on the straight line.

5. The method of claim 4, wherein, The step of obtaining the straight line equation of the straight line based on the coordinates of the at least two pixel points on the straight line comprises the following step: cross-multiplying the homogeneous coordinates of the at least two pixel points to obtain the straight line equation of the straight line; wherein the homogeneous coordinates of the at least two pixel points are obtained after distortion correction of the pixel points.

6. The method of claim 1, wherein, Before the step of obtaining the straight line calibration object from the reference image and the to-be-calibrated image respectively, the method further comprises the following steps: detecting all straight lines in the reference image and the to-be-calibrated image; obtaining a straight line pair that meets a preset condition in the reference image and the to-be-calibrated image respectively as the straight line calibration object.

7. The method of claim 6, wherein, The preset condition is that the straight line pair is the two mutually parallel straight lines farthest apart in the image, or the area occupied by the region contained by the straight line pair is the largest in the image, and the region contained by the straight line pair is the region between the two mutually parallel straight lines contained by the straight line pair.

8. An electronic device, comprising: The electronic device comprises a memory and a processor coupled to each other, The memory stores program instructions; The processor is configured to execute the program instructions stored in the memory to implement the method of any one of claims 1-7.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium is configured to store program instructions executable by the processor to implement the method of any one of claims 1-7.