Camera online calibration method, device, computer equipment and storage medium
By calculating the initial pose value of the camera and performing global optimization, it solves the high cost and cumbersome operation problems of traditional camera calibration methods, and achieves low-cost, high-accuracy online camera calibration in any environment.
Patent Information
- Application Number
- CN202010338913.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-26
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-04-26
AI Technical Summary
Traditional camera calibration methods are costly, cumbersome to operate, and cannot meet real-time calibration requirements. Existing online calibration solutions rely on initial values and have errors when calibrating on unreasonable roads.
This method achieves online camera calibration by obtaining the current frame image, previous frame image and driving mileage of the camera, calculating the initial pose value, and combining it with the global optimization algorithm to minimize the global reprojection error.
There is no need to limit calibration scenarios. It has low cost, minimal operating requirements, and a wide range of applicable scenarios to ensure the accuracy of calibration results and is suitable for different operators.
Smart Images

Figure CN113554711B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent vehicle technology, and in particular to a camera online calibration method, device, computer equipment and storage medium. Background Art
[0002] The accuracy of camera calibration data directly determines the performance of the panoramic view system. In actual use, traditional solutions usually use offline calibration to obtain camera calibration. However, such solutions require high-precision calibration stations and complicated manual operations, which are costly, difficult to promote, and cannot meet real-time calibration needs. Online calibration solutions have been developed, which generally require vehicles to be calibrated on specific roads. However, such solutions generally rely on a reasonable initial value and require calibration on roads that meet the requirements. When the initial value is incorrect, it will cause calibration errors. Summary of the invention
[0003] Based on this, it is necessary to provide a camera online calibration method, device, computer equipment and storage medium that can improve the accuracy of camera online calibration in response to the above technical problems.
[0004] A camera online calibration method, the method comprising:
[0005] Obtain the current frame image, the previous frame image, and the vehicle mileage from the previous frame image to the current frame image taken by the camera;
[0006] Calculate the initial position and posture value of each camera corresponding to the current frame image according to the current frame image, the previous frame image and the mileage;
[0007] Obtaining the initial height of each camera corresponding to the current frame image;
[0008] A global optimization is performed based on the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and the current pose value of each camera corresponding to the current frame image is obtained as a calibration value.
[0009] In the above embodiment, there is no need to limit the calibration scene. The calibration can be completed in any flat and textured environment according to specific driving operations. Compared with traditional calibration solutions and most online calibration solutions on the market, this embodiment has low cost, minimal personnel operation requirements, and is applicable to a wide range of scenarios. At the same time, it can ensure the accuracy of the calibration results under the operation of different operators.
[0010] In one embodiment, the step of calculating the initial pose value of each camera corresponding to the current frame image according to the current frame image, the previous frame image and the mileage includes:
[0011] Obtaining a camera pose change matrix of the single camera in a world coordinate system according to the current frame image and the previous frame image of the single camera;
[0012] Obtaining a vehicle position change matrix of the vehicle corresponding to the current frame image in a world coordinate system according to the mileage of the vehicle;
[0013] An initial position and posture value of a single camera corresponding to the current frame image is obtained according to a hand-eye calibration algorithm.
[0014] In the above embodiment, not only the camera pose change matrix of a single camera in the world coordinate system is obtained according to the current frame image and the previous frame image of the camera, but also because the vehicle can only provide planar motion and the initial height value of each camera cannot be obtained, the vehicle position change matrix of the vehicle in the world coordinate system corresponding to the current frame image is obtained in combination with the vehicle's mileage, so that the initial pose value of a single camera is more accurate, and further, under the condition of this reasonable initial value, the accuracy of subsequent camera online calibration can be guaranteed.
[0015] In one of the embodiments, obtaining a camera pose change matrix of a single camera in a world coordinate system according to the current frame image and the previous frame image of the single camera includes:
[0016] When the current frame image is a second frame image taken by the camera, obtaining matching point pairs in the second frame image and the first frame image;
[0017] The camera pose change matrix is calculated based on the obtained matching point pairs by solving the essential matrix.
[0018] In the above embodiment, since there is no initial value of the camera pose at the beginning, in this embodiment, an estimated pose is obtained by essential matrix decomposition to start the process, and then the camera pose change matrix can be obtained, and then the camera pose in the subsequent frames of the image can be calculated based on the camera pose change matrix, which is more accurate.
[0019] In one of the embodiments, obtaining a camera pose change matrix of a single camera in a world coordinate system according to the current frame image and the previous frame image of the single camera includes:
[0020] When the current frame image is not the first frame image and the second frame image, obtaining a camera pose matrix of the previous frame image according to a hand-eye calibration algorithm and a camera pose change matrix corresponding to the previous frame image;
[0021] Acquire the matching point pairs in the previous frame image and the current frame image, and obtain corresponding three-dimensional estimated points according to the camera pose matrix of the previous frame image and the matching point pairs;
[0022] Minimizing reprojection is performed based on the three-dimensional estimated points and the camera pose matrix to obtain a camera pose change matrix corresponding to the current frame image.
[0023] In the above embodiment, the position and posture of a single camera corresponding to each frame of image is obtained in a loop, and the loop is performed according to the camera position and posture change matrix, so that the camera position and posture of each frame of image is more accurate.
[0024] In one embodiment, the calculating of the initial pose value of each camera corresponding to the current frame image according to the current frame image, the previous frame image and the mileage further includes:
[0025] The initial position and posture value of each camera corresponding to the current frame image is calculated based on the current frame image, the previous frame image and the mileage by using a vanishing point method or an optical flow tracking method.
[0026] In the above embodiment, the initial pose value of each camera can also be obtained by using a vanishing point method or an optical flow tracking method, so as to lay a foundation for subsequent global optimization.
[0027] In one embodiment, the obtaining of the initial height of each camera corresponding to the current frame image includes:
[0028] Acquire an end feature point from the current frame image, and acquire a corresponding start feature point from the previous frame image;
[0029] The initial height of each camera is calculated based on the distance between the starting point and the end point, and the mileage of the vehicle.
[0030] In the above embodiment, since the vehicle can only provide planar motion and the initial height value of each camera cannot be obtained, the vehicle position change matrix of the vehicle in the world coordinate system corresponding to the current frame image is obtained in combination with the vehicle's mileage, so that the initial pose value of a single camera is more accurate. Furthermore, under the condition of this reasonable initial value, the accuracy of subsequent camera online calibration can be guaranteed.
[0031] In one embodiment, obtaining the initial height of each camera corresponding to the current frame image includes:
[0032] The initial height of each camera corresponding to the current frame image is acquired through a sensor installed on the vehicle.
[0033] In the above embodiment, since the vehicle can only provide planar motion, it is impossible to obtain the initial height value of each camera. Therefore, the vehicle position change matrix of the vehicle corresponding to the current frame image in the world coordinate system is obtained in combination with the vehicle's mileage, so that the initial pose value of a single camera is more accurate. In addition, under the condition of this reasonable initial value, the accuracy of subsequent camera online calibration can be guaranteed.
[0034] In one embodiment, obtaining the initial height of each camera corresponding to the current frame image includes:
[0035] The initial height of each camera corresponding to the current frame image is obtained according to a projection transformation method or a point cloud fitting ground method.
[0036] In the above embodiment, since the vehicle can only provide planar motion and the initial height value of each camera cannot be obtained, the vehicle position change matrix of the vehicle in the world coordinate system corresponding to the current frame image is obtained in combination with the vehicle's mileage, so that the initial pose value of a single camera is more accurate. Furthermore, under the condition of this reasonable initial value, the accuracy of subsequent camera online calibration can be guaranteed.
[0037] In one embodiment, the global optimization is performed based on the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and the current pose value of each camera corresponding to the current frame image is obtained as a calibration value, including:
[0038] The bundle adjustment method is used to perform global optimization according to the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and the current pose value of each camera corresponding to the current frame image is obtained as a calibration value.
[0039] In the above embodiment, the bundle adjustment method is used to minimize the overlap error of all feature points reprojected into the world coordinates, thereby obtaining the optimal solution of the positions and postures of all cameras, which is more accurate.
[0040] A camera online calibration device, the device comprising:
[0041] A data acquisition module is used to acquire the current frame image, the previous frame image and the mileage of the vehicle from the previous frame image to the current frame image taken by the camera;
[0042] A single camera initial pose value acquisition module, used to calculate the initial pose value of each camera corresponding to the current frame image according to the current frame image, the previous frame image and the mileage;
[0043] A single camera initial height acquisition module, used to acquire the initial height of each camera corresponding to the current frame image;
[0044] The global optimization module is used to perform global optimization according to the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and obtain the current pose value of each camera corresponding to the current frame image as a calibration value.
[0045] In the above embodiment, there is no need to limit the calibration scene. The calibration can be completed in any flat and textured environment according to specific driving operations. Compared with traditional calibration solutions and most online calibration solutions on the market, this embodiment has low cost, minimal personnel operation requirements, and is applicable to a wide range of scenarios. At the same time, it can ensure the accuracy of the calibration results under the operation of different operators.
[0046] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0047] In the above embodiment, there is no need to limit the calibration scene. The calibration can be completed in any flat and textured environment according to specific driving operations. Compared with traditional calibration solutions and most online calibration solutions on the market, this embodiment has low cost, minimal personnel operation requirements, and is applicable to a wide range of scenarios. At the same time, it can ensure the accuracy of the calibration results under the operation of different operators.
[0048] A computer-readable storage medium stores a computer program, which implements the steps of any of the above methods when executed by a processor.
[0049] In the above embodiment, there is no need to limit the calibration scene. The calibration can be completed in any flat and textured environment according to specific driving operations. Compared with traditional calibration solutions and most online calibration solutions on the market, this embodiment has low cost, minimal personnel operation requirements, and is applicable to a wide range of scenarios. At the same time, it can ensure the accuracy of the calibration results under the operation of different operators. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A diagram showing an application environment of a camera online calibration method in one embodiment;
[0051] Figure 2 1 is a flow chart of a camera online calibration method according to an embodiment;
[0052] Figure 3 A flowchart of steps for obtaining an initial pose value of a single camera in one embodiment;
[0053] Figure 4A schematic diagram of solving the initial pose value of a single camera by using a hand-eye calibration algorithm in one embodiment;
[0054] Figure 5 for Figure 2 A schematic diagram of step S204 in the illustrated embodiment;
[0055] Figure 6 is a schematic diagram of a process of obtaining an initial height of a camera in one embodiment;
[0056] Figure 7 is a structural block diagram of a camera online calibration device in one embodiment;
[0057] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. 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.
[0059] The camera online calibration method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the camera 102 can communicate with the controller 104 on the vehicle. Thus, the controller 104 can obtain the images taken by the camera, and obtain the initial pose value of each corresponding camera in real time based on these images, for example, the initial pose value of each camera corresponding to the current frame image is calculated according to the current frame image, the previous frame image and the mileage, and the initial height of each camera corresponding to the current frame image is obtained; thereby, global optimization is performed according to the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and the current pose value of each camera corresponding to the current frame image is obtained and used as the calibration value, so that there is no need to limit the calibration scene, only according to specific driving operations, the calibration can be completed in any flat and texture-rich environment. Compared with traditional calibration schemes and most online calibration schemes on the market, this embodiment has low cost, minimal personnel operation requirements, and a wide range of applicable scenarios. At the same time, it can ensure the accuracy of the calibration results under the operation of different operators.
[0060] In one embodiment, Figure 2 As shown, a camera online calibration method is provided, which is applied to Figure 1 The controller in the example is used to illustrate the following steps:
[0061] S202: Acquire the current frame image, the previous frame image, and the mileage of the vehicle from the previous frame image to the current frame image taken by the camera.
[0062] Specifically, a vehicle may be equipped with multiple cameras, and the image captured by each camera may carry a timestamp, so that the controller can determine the corresponding current frame image based on the timestamp. The current frame image refers to the image captured by the camera at this moment. The previous frame image refers to the previous frame image adjacent to the current frame image captured by each camera. The mileage of the vehicle refers to the distance traveled by the vehicle during the acquisition period from the previous frame image to the current frame image. The distance can be obtained by collecting the vehicle's driving speed through the sensor installed on the vehicle, and then obtaining the time interval from the previous frame image to the current frame image, and calculating it through the driving speed and the time interval.
[0063] Optionally, the controller may divide the images captured by each camera, for example, the images captured by one camera form an image group, and sort the image frames in the image group according to the capturing time to facilitate subsequent processing.
[0064] S204: Calculate the initial pose value of each camera corresponding to the current frame image according to the current frame image, the previous frame image and the mileage.
[0065] Specifically, the controller can first obtain the camera's pose change matrix based on the current frame image and the previous frame image. This is because the surrounding reference objects, such as the ground or trees, will not change during the vehicle's driving process. Therefore, the vehicle's pose change matrix can be obtained based on these static reference objects and the vehicle's mileage. The vehicle's position change matrix can also be determined in combination with the vehicle's mileage, thereby obtaining the pose estimate value of a single camera, that is, the initial pose value here, that is, the initial pose value of the camera corresponding to the current frame image.
[0066] Specifically, the controller can obtain the initial pose value of the camera in a variety of ways. For example, in one embodiment, the initial pose value of each camera corresponding to the current frame image is calculated based on the current frame image, the previous frame image and the mileage, including: the vanishing point method, the PnP algorithm (the PnP solution algorithm refers to an algorithm that uses multiple pairs of 3D and 2D matching points, and minimizes the reprojection error to solve the camera extrinsic parameters when the camera intrinsic parameters are known or unknown) or the optical flow tracking method. The initial pose value of each camera corresponding to the current frame image is calculated based on the current frame image, the previous frame image and the mileage. In this embodiment, the initial pose value of each camera can also be obtained by the vanishing point method or the optical flow tracking method to lay the foundation for subsequent global optimization.
[0067] S206: Obtain the initial height of each camera corresponding to the current frame image.
[0068] Specifically, because the vehicle can only provide planar motion, the above initial pose value can only represent the initial translation value of the plane, and cannot obtain the initial height value of each camera. Therefore, it is necessary to estimate the initial height of each camera. The initial height estimation can be done in a variety of ways, such as by combining the vehicle's odometer information and using projection transformation to solve the height estimation of each camera, or by other methods, such as fitting the ground equation with the point cloud, adding sensors to directly obtain the camera height, etc.
[0069] In one of the embodiments, the initial height of each camera corresponding to the current frame image is obtained, including: obtaining the initial height of each camera corresponding to the current frame image through a sensor installed on the vehicle. In one of the embodiments, the initial height of each camera corresponding to the current frame image is obtained, including: obtaining the initial height of each camera corresponding to the current frame image according to a projection transformation method or a point cloud fitting ground method. In this embodiment, since the vehicle can only provide planar motion, it is impossible to obtain the initial height value of each camera. Therefore, the vehicle position change matrix of the vehicle corresponding to the current frame image in the world coordinate system is obtained in combination with the vehicle's mileage, so that the initial posture value of a single camera is more accurate, and then under the condition of this reasonable initial value, the accuracy of subsequent camera online calibration can be guaranteed.
[0070] S208: Perform global optimization based on the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and obtain the current pose value of each camera corresponding to the current frame image as a calibration value.
[0071] Specifically, after the controller obtains the initial values of all degrees of freedom of each camera, that is, the initial pose value and initial height of the camera, the controller can perform global optimization to minimize the global reprojection error and obtain the optimal solution of all current camera poses as the current pose value of each camera and as the calibration value. Among them, the vehicle's mileage also provides scale constraints to ensure that the pose optimization is within a reasonable range in the global optimization step.
[0072] The goal of global optimization is to minimize the overlap error of all feature points reprojected into world coordinates. The error can be measured by projecting the feature points into world coordinates using the current camera pose, and then calculating the distance of the world coordinates of the matched feature points as the error. The expression of the mathematical statistics of all errors is obtained, such as the sum of all errors, and then optimization is performed to minimize the sum of the errors, etc., to obtain the current pose value of each camera and use it as the calibration value.
[0073] Optionally, after each global optimization, the controller determines whether the obtained error is the smallest. If it is the smallest, the calibration is successful and ends. Otherwise, the above step S202 is continued to reacquire the current frame and continue the optimization. When judging, a new image frame can be re-captured, for example, the next image frame is captured, and then the next image frame corresponding to each camera is spliced, and the same marker after splicing is obtained. For example, if the camera online calibration is performed in a flat environment with rich textures, the corresponding texture features can be obtained as markers, and then the misalignment error of the same marker in the spliced image is determined. If the error meets the requirements, it means that the calibration is successful and ends. Otherwise, the next frame of the image is continued to be acquired as the current frame, and the camera is recalibrated.
[0074] In the above embodiment, there is no need to limit the calibration scene. The calibration can be completed in any flat and textured environment according to specific driving operations. Compared with traditional calibration solutions and most online calibration solutions on the market, this embodiment has low cost, minimal personnel operation requirements, and is applicable to a wide range of scenarios. At the same time, it can ensure the accuracy of the calibration results under the operation of different operators.
[0075] In one embodiment, see Figure 3 As shown, Figure 3 The flowchart is a step of obtaining the initial pose value of a single camera in one embodiment. In this embodiment, the steps mainly include the following steps:
[0076] S302: Obtaining a camera pose change matrix of the single camera in the world coordinate system according to the current frame image and the previous frame image of the single camera.
[0077] Specifically, the controller can calculate the camera pose change matrix in the world coordinate system by feature matching, such as the corresponding feature points in the previous frame image and the corresponding feature points in the current frame image. For example, the controller can first assume a camera pose change matrix containing unknown numbers, and then substitute it according to the determined feature points, so that each unknown number can be obtained, thereby obtaining the camera pose change matrix in the world coordinate system.
[0078] S304: Obtaining a vehicle position change matrix of the vehicle corresponding to the current frame image in the world coordinate system according to the mileage of the vehicle.
[0079] Specifically, the vehicle position change matrix is also in the world coordinate system, for example, it can be obtained by (x t ,y t , z t ) is used to represent the position of the vehicle in the current frame image, and (x t-1 ,y t-1 , zt-1 ) to represent the position of the vehicle in the previous frame. After knowing the position in the previous frame and the mileage and direction of the vehicle, the controller can calculate the position of the vehicle in the current frame (x t ,y t , z t ), so the vehicle position change matrix can be determined based on the two positions.
[0080] S306: Obtaining an initial pose value of a single camera corresponding to the current frame image according to a hand-eye calibration algorithm.
[0081] Specifically, the basis of the hand-eye calibration algorithm is:
[0082] H cam2veh *H cam =H veh *H cam2veh (1)
[0083] Among them, H cam is the camera pose change matrix, H veh is the vehicle position change matrix, H cam2veh is the initial pose value of a single camera.
[0084] According to the above formula, after the camera pose change matrix and the vehicle position change matrix are known, the initial pose value of a single camera can be obtained.
[0085] In the above embodiment, not only the camera pose change matrix of a single camera in the world coordinate system is obtained according to the current frame image and the previous frame image of the camera, but also because the vehicle can only provide planar motion and the initial height value of each camera cannot be obtained, the vehicle position change matrix of the vehicle in the world coordinate system corresponding to the current frame image is obtained in combination with the vehicle's mileage, so that the initial pose value of a single camera is more accurate, and further, under the condition of this reasonable initial value, the accuracy of subsequent camera online calibration can be guaranteed.
[0086] In one of the embodiments, a camera pose change matrix of a single camera in a world coordinate system is obtained based on a current frame image and a previous frame image of a single camera, including: when the current frame image is a second frame image taken by the camera, obtaining matching point pairs in the second frame image and the first frame image; and calculating the camera pose change matrix by solving the essential matrix based on the obtained matching point pairs.
[0087] In the above embodiment, since there is no initial value of the camera pose at the beginning, in this embodiment, an estimated pose is obtained by essential matrix decomposition to start the process, and then the camera pose change matrix can be obtained, and then the camera pose in the subsequent frames of the image can be calculated based on the camera pose change matrix, which is more accurate.
[0088] In one of the embodiments, a camera pose change matrix of a single camera in a world coordinate system is obtained based on a current frame image and a previous frame image of a single camera, including: when the current frame image is not the first frame image and the second frame image, the camera pose change matrix of the previous frame image is obtained based on a hand-eye calibration algorithm and the camera pose change matrix corresponding to the previous frame image; matching point pairs in the previous frame image and the current frame image are obtained, and corresponding three-dimensional estimation points are obtained based on the camera pose matrix of the previous frame image and the matching point pairs; and minimizing reprojection based on the three-dimensional estimation points and the camera pose matrix to obtain the camera pose change matrix corresponding to the current frame image.
[0089] In the above embodiment, the position and posture of a single camera corresponding to each frame of image is obtained in a loop, and the loop is performed according to the camera position and posture change matrix, so that the camera position and posture of each frame of image is more accurate.
[0090] Specifically, see Figure 4 and Figure 5 As shown, Figure 4 is a schematic diagram of solving the initial pose value of a single camera through a hand-eye calibration algorithm in one embodiment, Figure 5 for Figure 2 Schematic diagram of step S204 in the illustrated embodiment. In this embodiment, the PnP algorithm solves the camera pose change evidence between two frames of images. At this time, the camera pose (relative to the vehicle) needs to be solved by hand-eye calibration. The PnP algorithm needs to calculate 3D points each time, but it does not need the camera pose relative to the vehicle, only the camera pose change evidence between two frames. For the first frame, because there is no initial value, it is necessary to obtain an estimated pose by essential matrix decomposition as the input of the PnP algorithm to start the PnP algorithm.
[0091] Specifically, combined Figure 4 and Figure 5 , taking one of the cameras as an example, the controller first obtains the first frame image captured by the camera. The first frame image refers to a valid frame, which is not necessarily the first frame captured by the camera, but the first valid frame that can be used for online calibration of the camera.
[0092] The controller also obtains the second frame captured by the camera, and since there is no initial value at this time, the controller obtains the estimated pose of the camera through the method of essential matrix decomposition, where the essential matrix is a special case of the basic matrix, which is the basic matrix in the normalized image coordinate system. The controller can obtain the matching point pairs in the second frame image and the first frame image. For example, matching point pairs can be obtained based on the unchanged points on the vehicle, such as the position of the door, the position of the tire, etc., so that several pairs of matching point pairs are obtained, and then the camera pose change matrix is calculated by solving the essential matrix, that is, H in the figure. cam (1), then the camera pose matrix of the previous frame image can be obtained through the hand-eye calibration algorithm, the camera pose change matrix corresponding to the previous frame image, and the vehicle position change matrix between the two frames, that is, H cam2veh (1).
[0093] For images other than the first and second frames, since PnP has an initial value, that is, the camera pose change matrix corresponding to the previous frame, the camera pose evidence of the previous frame can be obtained, and then the matching points of the image can be determined according to the image. In this way, the corresponding three-dimensional estimated points can be obtained according to the camera pose matrix and matching point pairs of the previous frame, that is, the reprojected points. Then the controller minimizes the reprojection according to the three-dimensional estimated points and the camera pose matrix to obtain the camera pose change matrix corresponding to the current frame, wherein the minimization of reprojection can be based on the difference between the determined three-dimensional estimated points and the actual points (determined according to the current frame) as a measurement index, and the measurement index is minimized to determine the camera pose change matrix corresponding to the current frame.
[0094] In this way, the corresponding camera pose transformation matrix and initial pose value can be obtained by continuing the loop processing for subsequent frames.
[0095] In the above embodiment, since there is no initial value of the camera pose at the beginning, in this embodiment, an estimated pose is obtained by means of essential matrix decomposition to start, and then the camera pose change matrix can be obtained, and then the camera pose in each subsequent frame image is calculated based on the camera pose change matrix, which is more accurate. In addition, the pose of a single camera corresponding to each frame image is obtained in a loop, and the camera pose change matrix is looped to make the camera pose of each frame image more accurate.
[0096] In one of the embodiments, the initial height of each camera corresponding to the current frame image is obtained, including: obtaining an end feature point from the current frame image, and obtaining a corresponding start feature point from the previous frame image; and calculating the initial height of each camera according to the distance between the start point and the end point, and the mileage of the vehicle.
[0097] Specifically, see Figure 6 , Figure 6 A schematic diagram of a process for obtaining the initial height of a camera in one embodiment.
[0098] Among them, the controller can obtain the ending feature point and the corresponding starting feature point from the previous frame image. The ending feature point and the starting feature point are matching feature points and are located on the camera. In this way, the controller can calculate the initial height of each camera based on the distance between the starting point and the ending point and the vehicle's mileage through similarity principles.
[0099] in Figure 6 In, x (1) is the starting feature point, X (2) is the termination feature point. (1) is the point on the ground plane corresponding to the starting feature point, P (2) is the point on the ground plane corresponding to the termination feature point, where the camera height can be:
[0100]
[0101] In the above embodiment, since the vehicle can only provide planar motion and the initial height value of each camera cannot be obtained, the vehicle position change matrix of the vehicle in the world coordinate system corresponding to the current frame image is obtained in combination with the vehicle's mileage, so that the initial pose value of a single camera is more accurate. Furthermore, under the condition of this reasonable initial value, the accuracy of subsequent camera online calibration can be guaranteed.
[0102] In one embodiment, global optimization is performed based on the initial pose values, initial heights, and mileage of each camera to minimize the global reprojection error, and the current pose values of each camera corresponding to the current frame image are obtained as calibration values, including:
[0103] The bundle adjustment method is used to perform global optimization based on the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and the current pose value of each camera corresponding to the current frame image is obtained as the calibration value.
[0104] Specifically, after the controller obtains the initial values of all degrees of freedom of each camera, that is, the initial pose value and initial height of each camera, it performs global optimization to minimize the global reprojection error and obtain the optimal solution for all current camera poses.
[0105] The camera pose is optimized so that the overlap error of all feature points reprojected into the world coordinates is minimized. The measurement index can use the current camera pose to project the feature points into the world coordinates, and then calculate the distance of the world coordinates of the matched feature points. The optimal solution for all current camera poses is obtained by minimizing this distance.
[0106] In the above embodiment, the bundle adjustment method is used to minimize the overlap error of all feature points reprojected into the world coordinates, thereby obtaining the optimal solution of the positions and postures of all cameras, which is more accurate.
[0107] Please continue to see Figure 6 As shown, Figure 6 FIG. 1 is a flow chart of a camera online calibration method in another embodiment. In this embodiment, the initial pose values of each camera are first calculated. Specifically, the controller obtains the pose change H of the camera in the world coordinate system according to the feature matching between two frames of a single camera. cam , combined with the vehicle odometer to obtain the vehicle's posture change H veh , and then find the pose estimate H of a single camera cam2veh . Because the vehicle can only provide planar motion, the above process can only calculate the initial translation value of the plane, and cannot obtain the initial height value of each camera. Therefore, it is necessary to calculate and estimate the initial height of each camera. Finally, after the controller obtains the initial value of the full degree of freedom of each camera, it performs global optimization to minimize the global reprojection error and solve the optimal solution of all current camera poses. There are many algorithms for realizing the initial pose value of the camera, such as PnP, using vanishing points, using optical flow tracking, etc., which can all obtain robust initial pose values of the camera. By combining the odometer information of the vehicle, the projection transformation can be used to solve the height estimate of each camera, or other methods can be used, such as fitting the ground equation with the point cloud, adding sensors to directly obtain the camera height, etc., the method is not limited. The odometer information of the vehicle also provides scale constraints to ensure that the pose optimization is within a reasonable range in the global optimization step.
[0108] In the above embodiment, there is no need to limit the calibration scene. The calibration can be completed in any flat and textured environment according to specific driving operations. Compared with traditional calibration solutions and most online calibration solutions on the market, this embodiment has low cost, minimal personnel operation requirements, and is applicable to a wide range of scenarios. At the same time, it can ensure the accuracy of the calibration results under the operation of different operators.
[0109] It should be understood that although Figure 2 , Figure 3 as well as Figure 5 and Figure 6 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 , Figure 3 as well as Figure 5 and Figure 6At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0110] In one embodiment, Figure 7 As shown, a camera online calibration device is provided, comprising: a data acquisition module 100, a single camera initial pose value acquisition module 200, a single camera initial height acquisition module 300 and a global optimization module 400, wherein:
[0111] The data acquisition module 100 is used to acquire the current frame image, the previous frame image and the mileage of the vehicle from the previous frame image to the current frame image taken by the camera;
[0112] A single camera initial pose value acquisition module 200 is used to calculate the initial pose value of each camera corresponding to the current frame image according to the current frame image, the previous frame image and the mileage;
[0113] The initial height acquisition module 300 of a single camera is used to acquire the initial height of each camera corresponding to the current frame image;
[0114] The global optimization module 400 is used to perform global optimization based on the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, obtain the current pose value of each camera corresponding to the current frame image and use it as a calibration value.
[0115] In one embodiment, the above-mentioned single camera initial pose value acquisition module 200 may include:
[0116] A camera pose change matrix acquisition unit is used to obtain a camera pose change matrix of a single camera in a world coordinate system according to a current frame image and a previous frame image of the single camera;
[0117] A vehicle position change matrix acquisition unit is used to obtain a vehicle position change matrix of the vehicle corresponding to the current frame image in the world coordinate system according to the vehicle's mileage;
[0118] The initial pose value acquisition unit of a single camera is used to obtain the initial pose value of the single camera corresponding to the current frame image according to the hand-eye calibration algorithm.
[0119] In one embodiment, the camera pose change matrix acquisition unit may include:
[0120] A matching point pair acquisition subunit, used for acquiring matching point pairs in the second frame image and the first frame image when the current frame image is the second frame image taken by the camera;
[0121] The first camera pose change matrix acquisition subunit is used to calculate the camera pose change matrix by solving the essential matrix according to the acquired matching point pairs.
[0122] In one of the embodiments, the camera posture change matrix acquisition unit may further include:
[0123] The camera pose matrix acquisition subunit is used to acquire the camera pose matrix of the previous frame image according to the hand-eye calibration algorithm and the camera pose change matrix corresponding to the previous frame image when the current frame image is not the first frame image and the second frame image;
[0124] The 3D estimation point acquisition subunit is used to acquire the matching point pairs in the previous frame image and the current frame image, and obtain the corresponding 3D estimation points according to the camera pose matrix of the previous frame image and the matching point pairs;
[0125] The second camera pose change matrix acquisition subunit is used to perform minimization reprojection according to the three-dimensional estimated points and the camera pose matrix to obtain the camera pose change matrix corresponding to the current frame image.
[0126] In one of the embodiments, the module for acquiring the initial pose value of the camera can also be used to calculate the initial pose value of each camera corresponding to the current frame image according to the current frame image, the previous frame image and the mileage through a vanishing point method or an optical flow tracking method.
[0127] In one embodiment, the initial height acquisition module 300 of a single camera may include:
[0128] A feature point acquisition unit, used to acquire the end feature point from the current frame image, and acquire the corresponding start feature point from the previous frame image;
[0129] The initial height acquisition unit is used to calculate the initial height of each camera according to the distance between the starting point and the end point, and the mileage of the vehicle.
[0130] In one of the embodiments, the initial height acquisition module 300 for a single camera may also be used to acquire the initial heights of each camera corresponding to the current frame image through a sensor installed on the vehicle.
[0131] In one of the embodiments, the initial height acquisition module 300 of a single camera may also be used to acquire the initial heights of each camera corresponding to the current frame image according to a projection transformation method or a point cloud fitting ground method.
[0132] In one embodiment, the global optimization module 400 can also be used to perform global optimization based on the initial pose value, initial height and mileage of each camera using the bundle adjustment method to minimize the global reprojection error, and obtain the current pose value of each camera corresponding to the current frame image as a calibration value.
[0133] For the specific definition of the camera online calibration device, please refer to the definition of the camera online calibration method above, which will not be repeated here. Each module in the above-mentioned camera online calibration device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0134] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a camera online calibration method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0135] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0136] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining a current frame image, a previous frame image, and the mileage of a vehicle from the previous frame image to the current frame image taken by a camera; calculating an initial pose value of each camera corresponding to the current frame image according to the current frame image, the previous frame image, and the mileage; obtaining an initial height of each camera corresponding to the current frame image; performing global optimization according to the initial pose value, the initial height, and the mileage of each camera to minimize the global reprojection error, and obtaining the current pose value of each camera corresponding to the current frame image as a calibration value.
[0137] In one embodiment, the processor executes a computer program to calculate the initial pose value of each camera corresponding to the current frame image based on the current frame image, the previous frame image and the mileage, including: obtaining a camera pose change matrix of a single camera in a world coordinate system based on the current frame image and the previous frame image of the single camera; obtaining a vehicle position change matrix of a vehicle corresponding to the current frame image in a world coordinate system based on the mileage of the vehicle; and obtaining the initial pose value of a single camera corresponding to the current frame image based on a hand-eye calibration algorithm.
[0138] In one embodiment, the processor executes a computer program to obtain a camera pose change matrix of a single camera in a world coordinate system based on a current frame image and a previous frame image of the single camera, including: when the current frame image is a second frame image taken by the camera, obtaining matching point pairs in the second frame image and the first frame image; and calculating the camera pose change matrix by solving the essential matrix based on the obtained matching point pairs.
[0139] In one embodiment, the processor executes a computer program to obtain a camera pose change matrix of a single camera in a world coordinate system based on a current frame image and a previous frame image of the single camera, including: when the current frame image is not the first frame image or the second frame image, obtaining the camera pose change matrix of the previous frame image according to a hand-eye calibration algorithm and the camera pose change matrix corresponding to the previous frame image; obtaining matching point pairs in the previous frame image and the current frame image, and obtaining corresponding three-dimensional estimated points according to the camera pose matrix of the previous frame image and the matching point pairs; and performing minimization reprojection according to the three-dimensional estimated points and the camera pose matrix to obtain the camera pose change matrix corresponding to the current frame image.
[0140] In one embodiment, the processor executes a computer program to calculate the initial pose value of each camera corresponding to the current frame image based on the current frame image, the previous frame image and the mileage, and also includes: calculating the initial pose value of each camera corresponding to the current frame image based on the current frame image, the previous frame image and the mileage through a vanishing point method or an optical flow tracking method.
[0141] In one embodiment, the processor executes a computer program to obtain the initial height of each camera corresponding to the current frame image, including: obtaining the end feature point from the current frame image, and obtaining the corresponding start feature point from the previous frame image; and calculating the initial height of each camera based on the distance between the start point and the end point, and the mileage of the vehicle.
[0142] In one embodiment, obtaining the initial height of each camera corresponding to the current frame image when the processor executes the computer program includes: obtaining the initial height of each camera corresponding to the current frame image through a sensor installed on the vehicle.
[0143] In one embodiment, the processor executes a computer program to obtain the initial height of each camera corresponding to the current frame image, including: obtaining the initial height of each camera corresponding to the current frame image according to a projection transformation method or a point cloud fitting ground method.
[0144] In one embodiment, the processor performs global optimization based on the initial pose value, initial height and mileage of each camera when executing the computer program to minimize the global reprojection error, obtain the current pose value of each camera corresponding to the current frame image and use it as the calibration value, including: using the bundle adjustment method to perform global optimization based on the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, obtain the current pose value of each camera corresponding to the current frame image and use it as the calibration value.
[0145] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining a current frame image, a previous frame image, and the mileage of the vehicle from the previous frame image to the current frame image taken by a camera; calculating an initial pose value of each camera corresponding to the current frame image according to the current frame image, the previous frame image, and the mileage; obtaining an initial height of each camera corresponding to the current frame image; performing global optimization according to the initial pose value, initial height, and mileage of each camera to minimize the global reprojection error, and obtaining the current pose value of each camera corresponding to the current frame image as a calibration value.
[0146] In one embodiment, the computer program implemented when executed by the processor calculates the initial pose value of each camera corresponding to the current frame image according to the current frame image, the previous frame image and the mileage, including: obtaining the camera pose change matrix of the single camera in the world coordinate system according to the current frame image and the previous frame image of the single camera; obtaining the vehicle position change matrix of the vehicle corresponding to the current frame image in the world coordinate system according to the mileage of the vehicle; and obtaining the initial pose value of the single camera corresponding to the current frame image according to the hand-eye calibration algorithm.
[0147] In one embodiment, the computer program implemented when executed by the processor obtains the camera pose change matrix of a single camera in the world coordinate system based on the current frame image and the previous frame image of the single camera, including: when the current frame image is the second frame image taken by the camera, obtaining the matching point pairs in the second frame image and the first frame image; and calculating the camera pose change matrix by solving the essential matrix based on the obtained matching point pairs.
[0148] In one embodiment, a computer program implemented when executed by a processor obtains a camera pose change matrix of a single camera in a world coordinate system based on a current frame image and a previous frame image of a single camera, including: when the current frame image is not the first frame image or the second frame image, obtaining the camera pose change matrix of the previous frame image according to a hand-eye calibration algorithm and the camera pose change matrix corresponding to the previous frame image; obtaining matching point pairs in the previous frame image and the current frame image, and obtaining corresponding three-dimensional estimated points according to the camera pose matrix of the previous frame image and the matching point pairs; and performing minimization reprojection according to the three-dimensional estimated points and the camera pose matrix to obtain the camera pose change matrix corresponding to the current frame image.
[0149] In one embodiment, the computer program implemented when executed by the processor calculates the initial pose value of each camera corresponding to the current frame image based on the current frame image, the previous frame image and the mileage, and also includes: calculating the initial pose value of each camera corresponding to the current frame image based on the current frame image, the previous frame image and the mileage through a vanishing point method or an optical flow tracking method.
[0150] In one embodiment, the computer program executed by the processor to obtain the initial height of each camera corresponding to the current frame image includes: obtaining the end feature point from the current frame image, and obtaining the corresponding start feature point from the previous frame image; and calculating the initial height of each camera according to the distance between the start point and the end point, and the mileage of the vehicle.
[0151] In one embodiment, the method of obtaining the initial height of each camera corresponding to the current frame image when the computer program is executed by the processor includes: obtaining the initial height of each camera corresponding to the current frame image through a sensor installed on the vehicle.
[0152] In one embodiment, the computer program executed by the processor to obtain the initial height of each camera corresponding to the current frame image includes: obtaining the initial height of each camera corresponding to the current frame image according to a projection transformation method or a point cloud fitting ground method.
[0153] In one embodiment, the computer program implemented when executed by the processor performs global optimization based on the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, obtains the current pose value of each camera corresponding to the current frame image and uses it as the calibration value, including: using the bundle adjustment method to perform global optimization based on the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, obtains the current pose value of each camera corresponding to the current frame image and uses it as the calibration value.
[0154] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0155] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0156] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A camera online calibration method, characterized in that: The method comprises: Obtain the current frame image, the previous frame image, and the vehicle mileage from the previous frame image to the current frame image taken by the camera; Calculate the initial position and posture value of each camera corresponding to the current frame image according to the current frame image, the previous frame image and the mileage; Obtaining the initial height of each camera corresponding to the current frame image; Performing global optimization according to the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and obtaining the current pose value of each camera corresponding to the current frame image as a calibration value; The calculating, according to the current frame image, the previous frame image and the mileage, of the initial pose value of each camera corresponding to the current frame image comprises: Obtaining a camera pose change matrix of the single camera in a world coordinate system according to the current frame image and the previous frame image of the single camera; Obtaining a vehicle position change matrix of the vehicle corresponding to the current frame image in a world coordinate system according to the mileage of the vehicle; An initial position and posture value of a single camera corresponding to the current frame image is obtained according to a hand-eye calibration algorithm.
2. The method according to claim 1, characterized in that The step of obtaining a camera pose change matrix of a single camera in a world coordinate system according to the current frame image and the previous frame image of the single camera includes: When the current frame image is a second frame image taken by the camera, obtaining matching point pairs in the second frame image and the first frame image; The camera pose change matrix is calculated based on the obtained matching point pairs by solving the essential matrix.
3. The method according to claim 1, characterized in that The step of obtaining a camera pose change matrix of a single camera in a world coordinate system according to the current frame image and the previous frame image of the single camera includes: When the current frame image is not the first frame image and the second frame image, obtaining a camera pose matrix of the previous frame image according to a hand-eye calibration algorithm and a camera pose change matrix corresponding to the previous frame image; Acquire the matching point pairs in the previous frame image and the current frame image, and obtain corresponding three-dimensional estimated points according to the camera pose matrix of the previous frame and the matching point pairs; Minimizing reprojection is performed based on the three-dimensional estimated points and the camera pose matrix to obtain a camera pose change matrix corresponding to the current frame image.
4. The method according to claim 1, characterized in that: The initial position and posture value of each camera corresponding to the current frame image is calculated according to the current frame image, the previous frame image and the mileage, and further includes: The initial position and posture value of each camera corresponding to the current frame image is calculated based on the current frame image, the previous frame image and the mileage by using a vanishing point method or an optical flow tracking method.
5. The method according to any one of claims 1 to 4, characterized in that: The obtaining of the initial height of each camera corresponding to the current frame image includes: Acquire an end feature point from the current frame image, and acquire a corresponding start feature point from the previous frame image; The initial height of each camera is calculated based on the distance between the starting feature point and the ending feature point and the mileage of the vehicle.
6. The method according to any one of claims 1 to 4, characterized in that: The obtaining of the initial height of each camera corresponding to the current frame image includes: The initial height of each camera corresponding to the current frame image is acquired through a sensor installed on the vehicle.
7. The method according to any one of claims 1 to 4, characterized in that: The obtaining of the initial height of each camera corresponding to the current frame image includes: The initial height of each camera corresponding to the current frame image is obtained according to a projection transformation method or a point cloud fitting ground method.
8. The method according to any one of claims 1 to 4, characterized in that: The global optimization is performed according to the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and the current pose value of each camera corresponding to the current frame image is obtained as a calibration value, including: The bundle adjustment method is used to perform global optimization according to the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and the current pose value of each camera corresponding to the current frame image is obtained as a calibration value.
9. A camera online calibration device, characterized in that: The device comprises: A data acquisition module is used to acquire the current frame image, the previous frame image and the mileage of the vehicle from the previous frame image to the current frame image taken by the camera; A single camera initial pose value acquisition module, used to calculate the initial pose value of each camera corresponding to the current frame image according to the current frame image, the previous frame image and the mileage; A single camera initial height acquisition module, used to acquire the initial height of each camera corresponding to the current frame image; A global optimization module, used to perform global optimization according to the initial pose value, initial height and mileage of each camera to minimize the global reprojection error, and obtain the current pose value of each camera corresponding to the current frame image as a calibration value; The calculating, according to the current frame image, the previous frame image and the mileage, of the initial pose value of each camera corresponding to the current frame image comprises: Obtaining a camera pose change matrix of the single camera in a world coordinate system according to the current frame image and the previous frame image of the single camera; Obtaining a vehicle position change matrix of the vehicle corresponding to the current frame image in a world coordinate system according to the mileage of the vehicle; An initial position and posture value of a single camera corresponding to the current frame image is obtained according to a hand-eye calibration algorithm.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Dynamic calibration system, and combined optimization method and combined optimization device in dynamic calibration system
CN105844624A
Non-overlapping field-of-view camera gesture calibration method based on point cloud feature map registration
CN108648240A
Monocular vision tracking method and device, and storage medium
CN108765498A
Calibration method and device for vehicle-mounted camera, vehicle and storage medium
CN109389650A
A method and apparatus for determining that pose of a camera and an electronic device
CN109544629A
