A method and system for calibrating external parameters of CMS camera of electronic rearview mirror

By setting landmark points within the field of view of the electronic rearview mirror, establishing the corresponding relationship between the body world coordinate system and the undistorted image, and calculating distance constraints, it solves the problem of inability to accurately calibrate in the existing technology and achieves fast and accurate exterior imaging. Parameter calibration reduces the difficulty of calibration and improves accuracy.

CN117078769BActive Publication Date: 2024-08-23AUTOMOBILE TECH (WUHAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311063135.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-21
Publication Date
2024-08-23
Estimated Expiration
2043-08-21

AI Technical Summary

Technical Problem

The existing electronic rearview mirror CMS camera cannot perform accurate parameter calibration without knowing the initial angle, and the existing calibration method is cumbersome and cannot achieve full correction.

Method used

By setting multiple landmark points on the side of the vehicle body, the corresponding relationship between the vehicle body world coordinate system and the undistorted image is established, the straight line equation and distance constraints are calculated, and the nonlinear optimization method is used to solve the external parameters of the camera to achieve fast and accurate parameter calibration.

Benefits of technology

It reduces the difficulty of calibration and improves the accuracy of calibration. It can realize external parameter optimization without knowing the initial angle of the camera, supports fast calibration or improves calibration accuracy, and can choose whether to calibrate internal parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117078769B
    Figure CN117078769B
Patent Text Reader

Abstract

The present invention discloses a method and system for calibrating external parameters of a CMS camera of an electronic rearview mirror, the method comprising: setting a plurality of marker points within the field of view of the electronic rearview mirror to be calibrated, establishing a correspondence between a 3D point in a vehicle body world coordinate system and a 2D point in an undistorted image, and a correspondence between an undistorted point and a distorted point, converting the coordinates of each ground marker point from the vehicle body world coordinate system to the coordinate system of the undistorted image; calculating the straight line equations between the undistorted points corresponding to different ground marker points in the coordinate system of the undistorted image; respectively constructing distance constraints from the undistorted points corresponding to a plurality of sampling points on the straight line between the ground marker points to the corresponding straight line equations, taking the minimum sum of the distance constraints as the objective function, and solving the external parameters of the electronic rearview mirror to be calibrated. The present invention can realize external parameter optimization without knowing the initial angle of the camera, reduces the calibration difficulty of the electronic rearview mirror, and realizes rapid calibration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of vehicle electronic rearview mirror CMS calibration, and in particular relates to a method and system for calibrating external parameters of a CMS camera of an electronic rearview mirror. Background Art

[0002] The vehicle's electronic rearview mirror camera is a basic tool for the vehicle to perceive the real-world distance. For example, it can display the accurate distance line and vehicle body and wheel position on the monitor through CMS, which is of great help to the parking process of passenger car and commercial vehicle drivers.

[0003] Generally, electronic rearview mirror CMS has an initial fixed angle, which is ensured by the Y-arm and installation process. However, for the camera, its angle error has a great influence on the final monitor display. Therefore, micro-correction of the camera's external parameters is an indispensable step. Micro-correction can adopt some customized methods according to actual needs and conditions.

[0004] The invention patent with publication number CN115063488A discloses a method and system for marking lines on a digital exterior rearview mirror system, which sets a distance calibration line of a set length and a set height at multiple set distances parallel to the rear of the vehicle or both sides of the vehicle body, generates a distance identification line in the monitor according to the first and last pixel points, compares the distance identification line with the distance calibration line one by one, and corrects the error. This method can only achieve a one-to-one correspondence between the physical calibration line and the identification line in the image, and cannot achieve full correction of the electronic rearview mirror CMS camera. When the angle or focal length of the camera changes, it needs to be recalibrated, and the calibration process is cumbersome.

[0005] Therefore, it is necessary to propose a full correction method to calibrate parameters without knowing the initial angle of the camera. Summary of the invention

[0006] In view of this, the present invention proposes a method and system for calibrating external parameters of a CMS camera of an electronic rearview mirror, which are used to solve the problem that accurate parameter calibration cannot be performed when the initial angle of the CMS camera is unknown.

[0007] In a first aspect, the present invention discloses a method for calibrating external parameters of a CMS camera of an electronic rearview mirror, the method comprising:

[0008] A first marking point and a second marking point are marked on the ground at a first set distance d0 from one side of the vehicle body, and a line connecting the first marking point and the second marking point is parallel to the one side of the vehicle body;

[0009] A third mark point is marked on the ground at a second set distance d1 from one side of the vehicle body, the line connecting the third mark point and the second mark point is parallel to one side of the rear of the vehicle, and the third mark point, the first mark point and the second mark point are all within the field of view of the electronic rearview mirror to be calibrated;

[0010] The image containing each ground mark point is collected by the camera, the correspondence between the 3D point in the world coordinate system of the vehicle body and the 2D point in the undistorted image and the correspondence between the undistorted point and the distorted point are established, and the coordinates of each ground mark point are converted from the world coordinate system of the vehicle body to the coordinate system of the undistorted image;

[0011] In the coordinate system of the undistorted image, the straight line equations between the undistorted points corresponding to different ground landmarks are calculated respectively;

[0012] Constructing distance constraints from undistorted points to corresponding straight line equations corresponding to multiple sampling points on the straight line between the ground landmark points respectively;

[0013] Taking the minimum sum of distance constraints as the objective function, the external parameters of the camera of the electronic rearview mirror to be calibrated are solved.

[0014] On the basis of the above technical solution, preferably, the method further comprises:

[0015] A fourth mark point is marked on the ground at a second set distance d1 from one side of the vehicle body, a line connecting the fourth mark point and the third mark point is parallel to one side of the vehicle body, and the fourth mark point is within the field of view of the electronic rearview mirror to be calibrated.

[0016] On the basis of the above technical solution, preferably, the correspondence between the 3D point in the world coordinate system of the vehicle body and the 2D point in the undistorted image is:

[0017]

[0018] Among them, (X, Y, Z) represents the 3D point in the world coordinate system of the vehicle body, (u, v) represents the 2D point in the undistorted image, R and T are the rotation matrix and displacement matrix to be solved, respectively, where T = -R'*T_clnw, R' is the transpose of R, T_clnw is the coordinate of the electronic rearview mirror to be calibrated in the world coordinate system of the vehicle body; M is the intrinsic parameter matrix of the camera.

[0019] Based on the above technical solution, preferably, the step of converting the coordinates of each ground marker point from the vehicle body world coordinate system to the coordinate system of the undistorted image specifically includes:

[0020] Assume that the undistorted point (u, v) and the distorted point (u d ,v d ) is:

[0021]

[0022] The conversion relationship from the vehicle body world coordinate system to the undistorted image coordinate system is:

[0023]

[0024] Where (o_x, o_y) represents the coordinates of any one of the first, second, third, and fourth ground marker points in the vehicle body world coordinate system, (u_x, u_y) represents the undistorted point corresponding to the marker point (o_x, o_y) in the coordinate system of the undistorted image, k1, k2, …, k n is the distortion coefficient, and f is the conversion function related to the distortion coefficient;

[0025] The coordinates of each ground mark point in the vehicle body world coordinate system are converted into undistorted points in the coordinate system of the undistorted image through the conversion relationship.

[0026] On the basis of the above technical solution, preferably, the step of respectively calculating the straight line equations between the undistorted points corresponding to different ground marker points in the coordinate system of the undistorted image specifically includes:

[0027] In the coordinate system of the undistorted image, the equation L1 of a straight line formed by the undistorted points corresponding to the first marker point and the second marker point, and the equation L2 of a straight line formed by the undistorted points corresponding to the third marker point and the second marker point are calculated.

[0028] On the basis of the above technical solution, preferably, the distance constraints from the undistorted points corresponding to the plurality of sampling points on the straight line between the ground marker points to the corresponding straight line equations are constructed specifically including:

[0029] Select n1 sampling points on the ground line formed by the first marker point and the second marker point, and calculate the distance Dis from the undistorted point corresponding to each sampling point k to the straight line equation L1 1_k , and we get

[0030] Select n2 sampling points on the ground line formed by the second and third marking points, and calculate the distance Dis from the undistorted point corresponding to each sampling point p to the straight line equation L2. 2_p , and we get

[0031] w k 、w p Dis 1_k 、Dis 2_p The weight coefficients are k=1,2,…,n1, p=1,2,…,n2.

[0032] On the basis of the above technical solution, preferably, the step of respectively calculating the straight line equations between the undistorted points corresponding to different ground marker points in the coordinate system of the undistorted image specifically includes:

[0033] In the coordinate system of the undistorted image, calculate the straight line equation L1 formed by the undistorted points corresponding to the first marker point and the second marker point, the straight line equation L2 formed by the undistorted points corresponding to the third marker point and the second marker point, and the straight line equation L3 formed by the undistorted points corresponding to the third marker point and the fourth marker point.

[0034] On the basis of the above technical solution, preferably, the distance constraints from the undistorted points corresponding to the plurality of sampling points on the straight line between the ground marker points to the corresponding straight line equations are constructed specifically including:

[0035] Select n1 sampling points on the ground line formed by the first marker point and the second marker point, and calculate the distance Dis from the undistorted point corresponding to each sampling point k to the straight line equation L1. 1_k , and sum to get the distance constraint

[0036] Select n2 sampling points on the ground line formed by the second and third marking points, and calculate the distance Dis from the undistorted point corresponding to each sampling point p to the straight line equation L2. 2_p , and sum to get the distance constraint

[0037] Select n3 sampling points on the ground line formed by the third and fourth marking points, and calculate the distance Dis from the undistorted point corresponding to each sampling point q to the straight line equation L3. 3_q , and sum to get the distance constraint

[0038] ω k ,ω p ,ω q Dis 1_k 、Dis 2_p 、Dis 3_q The weight coefficients are k=1,2,…,n1, p=1,2,…,n2, q=1,2,…,n3, and each distance constraint approaches 0.

[0039] On the basis of the above technical solution, preferably, the method of solving the external parameters of the electronic rearview mirror to be calibrated by taking the minimum sum of distance constraints as the objective function specifically includes:

[0040] Based on each distance constraint Li_sumDis, establish the objective function:

[0041]

[0042] Wherein, i=1,2,…,N, N=2 or 3;

[0043] Solve the objective function to obtain the coordinates of the undistorted point corresponding to each sampling point;

[0044] According to the correspondence between the undistorted points and the distorted points, and the correspondence between the 3D points in the vehicle body world coordinate system and the 2D points in the undistorted image, the external parameters R and T of the electronic rearview mirror are solved, where R is the rotation matrix and T is the translation matrix.

[0045] In a second aspect, the present invention discloses an external parameter calibration system for a CMS camera of an electronic rearview mirror, the system comprising:

[0046] Point marking module: used to mark the first mark point and the second mark point on the ground at a first set distance d0 from one side of the vehicle body, and the line connecting the first mark point and the second mark point is parallel to the side of the vehicle body; mark the third mark point on the ground at a second set distance d1 from one side of the vehicle body, and the line connecting the third mark point and the second mark point is parallel to the side of the rear of the vehicle, and the third mark point and the first mark point and the second mark point are all within the field of view of the electronic rearview mirror to be calibrated;

[0047] Coordinate transformation module: used to obtain images containing various ground markers, establish the correspondence between 3D points in the vehicle body world coordinate system and 2D points in the undistorted image, and the correspondence between undistorted points and distorted points, and transform the coordinates of various ground markers from the vehicle body world coordinate system to the coordinate system of the undistorted image;

[0048] Distance constraint module: used to calculate the straight line equations between the undistorted points corresponding to different ground markers in the coordinate system of the undistorted image; respectively construct distance constraints from the undistorted points corresponding to multiple sampling points on the straight line between the ground markers to the corresponding straight line equations;

[0049] Parameter solving module: used to solve the external parameters of the camera of the electronic rearview mirror to be calibrated by taking the minimum sum of the distance constraints of each straight line equation as the objective function. The present invention has the following beneficial effects compared with the prior art:

[0050] 1) The present invention forms parallel lines by setting a small number of marking points within the field of view of the electronic rearview mirror to be tested. Without knowing the initial angle of the camera, an objective function based on distance constraints can be established based on the correspondence between 3D points in the world coordinate system of the vehicle body and 2D points in the undistorted image, and the correspondence between undistorted points and distorted points, thereby optimizing external parameters, reducing the difficulty of calibration of the electronic rearview mirror, and achieving rapid calibration.

[0051] 2) The present invention selects multiple sampling points on the ground straight line, calculates the distance from the undistorted point corresponding to each sampling point to the corresponding straight line equation in the undistorted image, sums them up to obtain the distance constraint, establishes the objective function based on the principle that the distance constraint approaches 0, solves the objective function through a nonlinear optimization method, and improves the calibration accuracy.

[0052] 3) The present invention can select 2 or 3 ground surfaces for calibration as needed, which can achieve rapid calibration or improve calibration accuracy. At the same time, it can also select whether to calibrate internal parameters to achieve comprehensive parameter optimization. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0054] Figure 1 It is a schematic diagram of the principle of the external parameter calibration method of the electronic rearview mirror CMS camera of the present invention. DETAILED DESCRIPTION

[0055] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0056] Aiming at the shortcomings of the existing method for calibrating the external parameters of the CMS camera of the electronic rearview mirror, the present invention proposes a full correction method. The so-called full correction means correction without knowing the initial angle. The present invention can also be used for micro-correction when the initial angle is known.

[0057] The external parameter calibration mentioned in the present invention is to calibrate the angle and position relationship of the CMS camera relative to the vehicle body world coordinate system, so that any point in the vehicle body world coordinate system can correspond to the pixel point on the image collected by the CMS camera. Since the CMS generally fixes the installation position and the size of the Y arm, it is easy to obtain the coordinates of the CMS camera in the vehicle body world coordinate system, and it is easy to obtain the parameters required for implementing the present invention.

[0058] Example 1

[0059] The present invention provides a method for calibrating external parameters of a CMS camera of an electronic rearview mirror, the method comprising:

[0060] S1. Set a plurality of marking points within the field of view of the electronic rearview mirror to be calibrated.

[0061] First, establish the vehicle body world coordinate system on the ground.

[0062] See also Figure 1 The present invention marks a first mark point (s_x0, s_y0) and a second mark point (e_x0, e_y0) on the ground at a first set distance d0 from one side of the vehicle body, and a line l1 connecting the first mark point and the second mark point is parallel to one side of the vehicle body; a third mark point (e_x1, e_y1) is marked on the ground at a second set distance d1 from one side of the vehicle body, and a line l2 connecting the third mark point and the second mark point is parallel to the rear side of the vehicle, and the third mark point and the first mark point and the second mark point are all within the field of view of the electronic rearview mirror to be calibrated.

[0063] like Figure 1 As shown, a first mark point (s_x0, s_y0) is marked on the ground at a longitudinal distance D0 from the electronic rearview mirror and a lateral distance d0 from the vehicle body, a second mark point (e_x0, e_y0) is marked on the ground at a longitudinal distance D from the rear of the vehicle and a lateral distance d0 from the vehicle body; and a third mark point (e_x1, e_y1) is marked on the ground at a longitudinal distance D from the rear of the vehicle and a lateral distance d1 from the vehicle body.

[0064] In specific implementation, Example 1 can realize rapid calibration of external parameters of the electronic rearview mirror CMS camera through two lines l1 and l2.

[0065] S2. Establish the correspondence between the 3D points in the world coordinate system of the vehicle body and the 2D points in the undistorted image, as well as the correspondence between the undistorted points and the distorted points, and transform the coordinates of each ground landmark point from the world coordinate system of the vehicle body to the coordinate system of the undistorted image.

[0066] Assume that the known intrinsic parameters of the camera are focal length f x , f y , optical center c x , c y , and the distortion coefficients k1,…,k n . Images containing various ground landmarks are collected through the camera.

[0067] Assume that the first marker point (s_x0, s_y0) and the second marker point (e_x0, e_y0) are mapped to the pixel points (us_u0, us_v0) and (ue_u0, ue_v0) on the undistorted image, respectively. The third marker point (e_x1, e_y1) is mapped to the pixel points (us_u1, us_v1) on the undistorted image, respectively.

[0068] For an image sensor without distortion, the projection of a straight line in the vehicle body world coordinate system on a two-dimensional image must also be a straight line. According to the straight line constraint, all points with a lateral distance of d0 mapped to the undistorted image should be on the straight line formed by (us_u0,us_v0) and (ue_u0,ue_v0). Similarly, all points with a longitudinal distance of D mapped to the undistorted image should be on the straight line formed by (ue_u0,ue_v0) and (ue_u1,ue_v1). In this way, the correspondence between 3D points in the world system and 2D points in the undistorted image can be constructed, where the 2D points are constrained by straight lines.

[0069] The coordinates of a 3D point P(X,Y,Z) in the vehicle body world coordinate system and the corresponding pixel point coordinates p(u,v) in the undistorted image can be solved by the following correspondence between the 3D point in the vehicle body world coordinate system and the 2D point in the undistorted image:

[0070]

[0071] Among them, R and T are the external parameters to be solved, namely, the rotation matrix R and the displacement matrix T, wherein T = -R'*T_clnw, R' is the transpose of R, and T_clnw is the coordinate of the electronic rearview mirror to be calibrated in the vehicle body world coordinate system; is the intrinsic parameter matrix of the camera.

[0072] Assume that the corresponding function relationship between the distorted point and the undistorted point is:

[0073]

[0074] Since the undistorted points correspond one to one with the distorted points, the distorted points (u d ,v d ) to find the undistorted point (u,v):

[0075]

[0076] Then the transformation relationship between the vehicle body world coordinate system and the coordinate system of the undistorted image is:

[0077]

[0078] Among them, (o_x, o_y) represents the coordinates of any one of the first, second and third ground marker points in the vehicle body world coordinate system, and (u_x, u_y) represents the undistorted point corresponding to the marker point (o_x, o_y) in the coordinate system of the undistorted image.

[0079] Based on the above conversion relationship, the coordinates of each ground marker point in the vehicle body world coordinate system are converted into undistorted points in the coordinate system of the undistorted image through the conversion relationship:

[0080]

[0081]

[0082]

[0083] S3. Calculate the straight line equations between the undistorted points corresponding to different ground landmark points in the coordinate system of the undistorted image.

[0084] In the coordinate system of the undistorted image, calculate the equation of the straight line L1 formed by the undistorted points (us_u0, us_v0) and (ue_u0, ue_v0) corresponding to the first marker point and the second marker point: u = m1*v + b1;

[0085] The straight line equation L2 formed by the undistorted points (ue_u0, ue_v0) and (ue_u1, ue_v1) corresponding to the second marker point and the third marker point is: v=m2*u+b2.

[0086] S4. Construct distance constraints from undistorted points corresponding to multiple sampling points on the straight line between the ground landmark points to the corresponding straight line equations, and solve the external parameters of the electronic rearview mirror to be calibrated by minimizing the sum of the distance constraints as the objective function.

[0087] Select n1 sampling points on the ground line formed by the first marker point and the second marker point, and calculate the distance Dis from the undistorted point corresponding to each sampling point k to the straight line equation L1 1_k , and sum to get the distance constraint

[0088] In the vehicle body world coordinate system, the coordinates of a sampling point on the ground straight line formed by the first mark point and the second mark point are P_dk(X k ,Y k ,0), then use formula (1) to get the undistorted point p_dk(u k ,v k ) then point p_dk(u k ,v k ) to the straight line u=m1*v+b1 1_k Should be 0:

[0089]

[0090] Therefore, the distance constraint Should be close to 0.

[0091] Select n2 sampling points on the ground line formed by the second and third marking points, and calculate the distance Dis from the undistorted point corresponding to each sampling point p to the straight line equation L2. 2_p , and we get

[0092] In the above formula, w k 、w p Dis 1_k 、Dis 2_p The weight coefficients are k=1,2,…,n1, p=1,2,…,n2.

[0093] Based on the distance constraints L1_sumDis and L2_sumDis of the straight line equations L1 and L2, the objective function is established:

[0094]

[0095] Among them, i=1,2.

[0096] The nonlinear optimization method Levenberg-Marquardt (LM) is used to solve the objective function F1 to obtain the coordinates of the undistorted points corresponding to each sampling point;

[0097] The external parameters R and T of the electronic rearview mirror are solved according to the correspondence between the undistorted points and the distorted points, and the correspondence between the 3D points in the world coordinate system of the vehicle body and the 2D points in the undistorted image.

[0098] The present invention selects multiple sampling points on a ground straight line formed by a small number of landmark points, calculates the distance from the undistorted point corresponding to each sampling point to the corresponding straight line equation in the undistorted image, sums up the distance constraints, establishes an objective function based on the principle that the distance constraint approaches 0, solves the objective function through a nonlinear optimization method, and improves the calibration accuracy.

[0099] Example 2

[0100] The difference between the second embodiment and the first embodiment is that, based on the first mark point (s_x0, s_y0), the second mark point (e_x0, e_y0) and the third mark point (e_x1, e_y1) of the first embodiment, the fourth mark point is marked on the ground at a second set distance d1 from one side of the vehicle body, the line l3 connecting the fourth mark point and the third mark point is parallel to one side of the vehicle body, and the fourth mark point is within the field of view of the electronic rearview mirror to be calibrated. Specifically, the fourth mark point (s_x1, s_y1) is marked on the ground at a longitudinal distance D0 from the electronic rearview mirror and a lateral distance d1 from the vehicle body.

[0101] Different from Example 1, this Example 2 can achieve high-precision calibration of the external parameters of the electronic rearview mirror CMS camera through three lines l1, l2, and l3.

[0102] Assume that the mapping pixel point of the fourth marker point (e_x1, e_y1) on the undistorted image is (ue_u1, ue_v1). At this time, all points with a horizontal distance of d1 mapped to the undistorted image should be on the straight line formed by (us_u1, us_v1) and (ue_u1, ue_v1).

[0103] Convert the fourth landmark point to the coordinate system of the undistorted image to obtain the corresponding undistorted point:

[0104]

[0105] In the coordinate system of the undistorted image, three straight line equations are obtained:

[0106] The linear equation L1 formed by the undistorted points (us_u0, us_v0) and (ue_u0, ue_v0) corresponding to the first and second marker points: u = m1*v + b1;

[0107] The equation of the straight line L2 formed by the undistorted points (ue_u0, ue_v0) and (ue_u1, ue_v1) corresponding to the second and third marker points: v = m2*u + b2;

[0108] The straight line equation L3 formed by the undistorted points (us_u1, us_v1) and (ue_u1, ue_v1) corresponding to the third marker point and the fourth marker point is: u=m3*v+b3.

[0109] Then, distance constraints are established based on the above three straight line equations:

[0110] Select n1 sampling points on the ground line formed by the first marker point and the second marker point, and calculate the distance Dis from the undistorted point corresponding to each sampling point k to the straight line equation L1. 1_k , and sum to get the distance constraint

[0111] Select n2 sampling points on the ground line formed by the second and third marking points, and calculate the distance Dis from the undistorted point corresponding to each sampling point p to the straight line equation L2. 2_p , and sum to get the distance constraint

[0112] Select n3 sampling points on the ground line formed by the third and fourth marking points, and calculate the distance Dis from the undistorted point corresponding to each sampling point q to the straight line equation L3. 3_q , and sum to get the distance constraint

[0113] ω k ,ω p ,ω q Dis 1_k 、Dis 2_p 、Dis 3_q The weight coefficients are k=1,2,…,n1, p=1,2,…,n2, q=1,2,…,n3, and each distance constraint approaches 0.

[0114] Then, based on the distance constraints L1_sumDis, L2_sumDis, L3_sumDis of the straight line equations L1, L2, L3, the objective function is established:

[0115]

[0116] Among them, i=1,2,3.

[0117] The nonlinear optimization method Levenberg-Marquardt (LM) is used to solve the objective function F2 to obtain the coordinates of the undistorted points corresponding to each sampling point;

[0118] The external parameters R and T of the electronic rearview mirror are solved according to the correspondence between the undistorted points and the distorted points, and the correspondence between the 3D points in the world coordinate system of the vehicle body and the 2D points in the undistorted image.

[0119] In addition, since the distortion coefficients and intrinsic parameters of each camera are different, in Embodiment 1 and Embodiment 2 of the present invention, the obtained distortion coefficients and intrinsic parameters of the camera can also be used as their initial values, and the distortion coefficients and intrinsic parameters can be optimized in the process of solving the objective function through LM to obtain the final optimized value, or of course, they can be not optimized.

[0120] The present invention can select 2 or 3 ground surfaces for calibration as needed, thereby realizing rapid calibration or improving calibration accuracy. At the same time, it can also select whether to calibrate internal parameters to realize comprehensive parameter optimization.

[0121] Corresponding to the above method embodiment, the present invention also proposes an electronic rearview mirror CMS camera external parameter calibration system, the system comprising:

[0122] Point marking module: used to mark the first mark point and the second mark point on the ground at a first set distance d0 from one side of the vehicle body, and the line connecting the first mark point and the second mark point is parallel to the side of the vehicle body; mark the third mark point on the ground at a second set distance d1 from one side of the vehicle body, and the line connecting the third mark point and the second mark point is parallel to the side of the rear of the vehicle, and the third mark point and the first mark point and the second mark point are all within the field of view of the electronic rearview mirror to be calibrated;

[0123] Coordinate transformation module: used to obtain images containing various ground markers, establish the correspondence between 3D points in the vehicle body world coordinate system and 2D points in the undistorted image, and the correspondence between undistorted points and distorted points, and transform the coordinates of various ground markers from the vehicle body world coordinate system to the coordinate system of the undistorted image;

[0124] Distance constraint module: used to calculate the straight line equations between the undistorted points corresponding to different ground markers in the coordinate system of the undistorted image; respectively construct distance constraints from the undistorted points corresponding to multiple sampling points on the straight line between the ground markers to the corresponding straight line equations;

[0125] Parameter solving module: It is used to solve the external parameters of the camera of the electronic rearview mirror to be calibrated by taking the minimum sum of the distance constraints of each straight line equation as the objective function.

[0126] The above system embodiments and method embodiments correspond one to one, and for a brief description of the system embodiments, please refer to the method embodiments.

[0127] The present invention also discloses an electronic device, comprising: at least one processor, at least one memory, a communication interface and a bus; wherein the processor, memory, and communication interface communicate with each other through the bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to implement the aforementioned method of the present invention.

[0128] The present invention also discloses a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, wherein the computer instructions enable the computer to implement all or part of the steps of the method described in the embodiment of the present invention. The storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk, and other media that can store program codes.

[0129] The system embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be distributed to multiple network units. A person skilled in the art may select some or all of the modules according to actual needs to achieve the purpose of the solution of this embodiment without creative effort.

[0130] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for calibrating external parameters of an electronic rearview mirror CMS camera, characterized in that: The method comprises: A first marking point and a second marking point are marked on the ground at a first set distance d0 from one side of the vehicle body, and a line connecting the first marking point and the second marking point is parallel to the one side of the vehicle body; A third mark point is marked on the ground at a second set distance d1 from one side of the vehicle body, the line connecting the third mark point and the second mark point is parallel to one side of the rear of the vehicle, and the third mark point, the first mark point and the second mark point are all within the field of view of the electronic rearview mirror to be calibrated; The marking method of the first marking point, the second marking point and the marking point is specifically as follows: a first marking point is marked on the ground at a longitudinal distance D0 from the electronic rearview mirror and a lateral distance d0 from the vehicle body ( s_x 0 , s_y 0 ), mark the second mark point on the ground at a longitudinal distance D from the rear of the vehicle and a transverse distance d0 from the vehicle body ( e_x 0 , e_y 0 ); mark the third mark point on the ground at a longitudinal distance D from the rear of the vehicle and a transverse distance d1 from the vehicle body ( e_x 1 , e_y 1 ); The image containing each ground mark point is collected by the camera, the correspondence between the 3D point in the world coordinate system of the vehicle body and the 2D point in the undistorted image and the correspondence between the undistorted point and the distorted point are established, and the coordinates of each ground mark point are converted from the world coordinate system of the vehicle body to the coordinate system of the undistorted image; In the coordinate system of the undistorted image, the straight line equations between the undistorted points corresponding to different ground landmarks are calculated respectively; Constructing distance constraints from undistorted points to corresponding straight line equations corresponding to multiple sampling points on the straight line between the ground landmark points respectively; Taking the minimum sum of distance constraints of each straight line equation as the objective function, the external parameters of the camera of the electronic rearview mirror to be calibrated are solved; The method further comprises: A fourth mark point is marked on the ground at a second set distance d1 from one side of the vehicle body, a line connecting the fourth mark point and the third mark point is parallel to one side of the vehicle body, and the fourth mark point is within the field of view of the electronic rearview mirror to be calibrated; The correspondence between the 3D points in the vehicle body world coordinate system and the 2D points in the undistorted image is: ; in,( X , Y , Z ) represents the 3D point in the world coordinate system of the vehicle body, ( u , v ) represents a 2D point in the undistorted image, R , T are the rotation matrix and displacement matrix to be solved respectively, where T=-R'*T_clnw , R' for R Transpose , T_clnw is the coordinate of the electronic rearview mirror to be calibrated in the vehicle body world coordinate system; M is the intrinsic parameter matrix of the camera; The step of converting the coordinates of each ground marker point from the vehicle body world coordinate system to the coordinate system of the undistorted image specifically includes: Assume that the undistorted point ( u , v ) and distortion point ( u d , v d ) is: ; The conversion relationship from the vehicle body world coordinate system to the undistorted image coordinate system is: ; in, Represents the coordinates of any ground marker point among the first marker point, the second marker point, the third marker point, and the fourth marker point in the vehicle body world coordinate system. Represents the coordinate system of the undistorted image and the landmark points The corresponding undistorted point is is the distortion coefficient, f is the transfer function related to the distortion coefficient; The coordinates of each ground marker point in the vehicle body world coordinate system are converted into undistorted points in the coordinate system of the undistorted image through the conversion relationship; The step of respectively calculating the straight line equations between the undistorted points corresponding to different ground marker points in the coordinate system of the undistorted image specifically includes: Calculate the equation L1 of a straight line formed by the undistorted points corresponding to the first marker point and the second marker point, and the equation L2 of a straight line formed by the undistorted points corresponding to the third marker point and the second marker point in the coordinate system of the undistorted image; The distance constraints from the undistorted points corresponding to the plurality of sampling points on the straight line between the ground marker points to the corresponding straight line equations are specifically constructed as follows: Select n1 sampling points on the ground straight line formed by the first mark point and the second mark point, and calculate the k The distance from the corresponding undistorted point to the straight line equation L1 , and sum to get the distance constraint ; In the vehicle body world coordinate system, the coordinates of a sampling point on the ground straight line formed by the first mark point and the second mark point are P_dk ( X k , Y k ,0), the corresponding undistorted point is obtained through the transformation relationship: p_dk ( u k , v k ), undistorted point p_ dk ( u k , v k ) to the straight line Distance for: ; in, is the equation of the straight line L1; Select n2 sampling points on the ground line formed by the second and third marking points, and calculate the distance from the undistorted point corresponding to each sampling point p to the straight line equation L2 , and sum to get the distance constraint ; They are The weight coefficient of , and each distance constraint approaches 0; or The step of respectively calculating the straight line equations between the undistorted points corresponding to different ground marker points in the coordinate system of the undistorted image specifically includes: In the coordinate system of the undistorted image, calculate the straight line equation L1 formed by the undistorted points corresponding to the first marker point and the second marker point, the straight line equation L2 formed by the undistorted points corresponding to the third marker point and the second marker point, and the straight line equation L3 formed by the undistorted points corresponding to the third marker point and the fourth marker point; The distance constraints from the undistorted points corresponding to the plurality of sampling points on the straight line between the ground marker points to the corresponding straight line equations are specifically constructed as follows: Select on the ground straight line formed by the first mark point and the second mark point n 1 sampling point, calculate each sampling point separately k The distance from the corresponding undistorted point to the straight line equation L1 , and sum to get the distance constraint ; In the vehicle body world coordinate system, the coordinates of a sampling point on the ground straight line formed by the first mark point and the second mark point are P_dk ( X k , Y k ,0), the corresponding undistorted point is obtained through the transformation relationship: p_dk ( u k , v k ), undistorted point p_ dk ( u k , v k ) to the straight line Distance for: ; in, is the equation of the straight line L1; Select on the ground straight line formed by the second and third marking points n 2 sampling points, calculate each sampling point separately p The distance from the corresponding undistorted point to the straight line equation L2 , and sum to get the distance constraint ; Select on the ground straight line formed by the third and fourth marking points n 3 sampling points, calculate each sampling point separately q The distance from the corresponding undistorted point to the straight line equation L3 , and sum to get the distance constraint ; They are The weight coefficient of , and each distance constraint approaches 0; The method of solving the external parameters of the electronic rearview mirror to be calibrated by taking the minimum sum of the distance constraints of the linear equations as the objective function specifically includes: Based on each distance constraint Li_sumDis, establish the objective function: ; in, i =1,2,…,N, N=2 or 3; Solve the objective function to obtain the coordinates of the undistorted point corresponding to each sampling point; According to the correspondence between the undistorted point and the distorted point, and the correspondence between the 3D point in the vehicle body world coordinate system and the 2D point in the undistorted image, the external parameters R and T of the electronic rearview mirror are solved, where R is the rotation matrix and T is the translation matrix. The method further includes: obtaining the distortion coefficient and the intrinsic parameter of the camera as initial values, and optimizing the distortion coefficient and the intrinsic parameter of the camera in the process of solving the objective function.

2. An electronic rearview mirror CMS camera external parameter calibration system using the method described in claim 1, characterized in that: The system comprises: Point marking module: used to mark the first mark point and the second mark point on the ground at a first set distance d0 from one side of the vehicle body, and the line connecting the first mark point and the second mark point is parallel to the side of the vehicle body; mark the third mark point on the ground at a second set distance d1 from one side of the vehicle body, and the line connecting the third mark point and the second mark point is parallel to the side of the rear of the vehicle, and the third mark point and the first mark point and the second mark point are all within the field of view of the electronic rearview mirror to be calibrated; Coordinate transformation module: used to obtain images containing various ground markers, establish the correspondence between 3D points in the vehicle body world coordinate system and 2D points in the undistorted image, and the correspondence between undistorted points and distorted points, and transform the coordinates of various ground markers from the vehicle body world coordinate system to the coordinate system of the undistorted image; Distance constraint module: used to calculate the straight line equations between the undistorted points corresponding to different ground markers in the coordinate system of the undistorted image; respectively construct distance constraints from the undistorted points corresponding to multiple sampling points on the straight line between the ground markers to the corresponding straight line equations; Parameter solving module: It is used to solve the external parameters of the camera of the electronic rearview mirror to be calibrated by taking the minimum sum of the distance constraints of each straight line equation as the objective function.