Camera calibration method based on support vector regression model
Through the support vector regression model combined with the shooting perspective of multiple cameras, a calibration model of three-dimensional spatial coordinates is constructed, which solves the problem of low fitting accuracy in the existing technology, and realizes high-precision camera calibration, which is suitable for a variety of calibration scenarios and improves the Generalization ability and robustness.
Patent Information
- Application Number
- CN202411286606.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-01-10
AI Technical Summary
The existing camera calibration methods have low fitting accuracy, cannot effectively handle image distortion, and cannot jointly determine the three-dimensional spatial coordinates with the shooting angles of multiple cameras.
Using the support vector regression model, by setting up multiple cameras, shooting the same spatial area and moving the calibration plate, a calibration model that combines the shooting angles of multiple cameras to jointly determine the three-dimensional spatial coordinates, and using the Gaussian kernel function to fit the pixel coordinates and the world coordinates. The nonlinear relationship between the camera can achieve high-precision camera calibration.
It improves the accuracy of camera calibration, avoids overfitting problems, has high practical value, and is suitable for multiple calibration scenarios such as monocular cameras, multi-camera, checkerboards, etc., improving generalization ability and robustness.
Smart Images

Figure CN119295554A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a camera calibration method based on a support vector regression model. Background Art
[0002] Camera calibration is an important research direction in the fields of computer vision, image processing, and machine learning. The current mainstream method of camera calibration is to determine the internal and external parameters of the camera through the Zhang Zhengyou calibration method and the polynomial calibration method, so as to realize the conversion of two-dimensional image pixel coordinates and three-dimensional space coordinate information. This process usually requires the corresponding points of known three-dimensional space points in the image to be realized, that is, through the calibration plate.
[0003] The existing camera calibration methods mainly include those based on the pinhole imaging model (Zhang Zhengyou calibration) and the polynomial model. Both methods find the correspondence between the image pixel coordinates and the world coordinates, and then solve the camera parameters through optimization methods such as least squares method and gradient descent.
[0004] Methods based on traditional geometric models often assume that the parameters of the camera are linear or low-order nonlinear, and the fitting accuracy is not high. Secondly, based on traditional calibration methods, in most cases, only consider the establishment of a calibration model based on a single camera, and cannot combine the shooting angles of multiple cameras to jointly determine the coordinates of the three-dimensional space. In addition, the existing traditional calibration methods cannot achieve high-precision fitting when the image is distorted. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention provides a camera calibration method based on a support vector regression model, which solves the technical problem that the fitting accuracy of the traditional calibration method is low.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions: a camera calibration method based on a support vector regression model, the method comprising the following steps:
[0007] S1. Set up N cameras and shoot the same spatial area. Place the same calibration plate multiple times in this spatial area and move it parallel to the depth direction multiple times. Select any of the calibration plates placed once as the reference to establish a world coordinate system. Calculate the world coordinates (x, y, z) of each positioning point based on the world coordinate system and the pixel coordinates (u, v) of each positioning point after being photographed by each camera according to the specifications of the calibration plate.
[0008] S2. Based on the support vector regression algorithm, a calibration model f(x) is constructed to jointly determine the three-dimensional space coordinates by combining the shooting angles of N cameras;
[0009] S3. According to the world coordinates (x, y, z) and pixel coordinates (u, v), the calibration model f(x) is used to fit two functions u=f for each of the N cameras. 1 (x, y, z) and v = f 2 (x, y, z), realizes the mapping of the world coordinates (x, y, z) of any point in space to the pixel coordinates (u, v) on N cameras;
[0010] S4. Select any camera 1 from N cameras as the reference camera, select any positioning point in camera 1, and find the three-dimensional coordinates (xi, yi, zi) corresponding to the positioning point and the corresponding pixel coordinates (u, v) in other cameras according to the world coordinates (x, y, z) and pixel coordinates (u, v). i ,v i );
[0011] S5, use the calibration model f(x) to calibrate the pixel coordinates (u 1 ,v 1 ), and fit the pixel coordinates (u i ,v i ) between the mapping relationship (u i ,v i ) = f' 1 (u 1 ,v 1 ) and (u 1 ,v 1 ) = f' 2 (u i ,v i ), to realize the pixel coordinates (u i ,v i ) and the pixel coordinates of the corresponding point on camera 1 (u 1 ,v 1 )’s mutual mapping;
[0012] S6, using the calibration model f(x) and the mapping relationship (u i ,v i ) = f' 1 (u 1 ,v 1 ) and (u 1 ,v 1 ) = f' 2 (u i ,v i ), fitting the pixel coordinates (u 1 ,v 1 ) to world coordinates (x, y, z) 1 (u 1 ,v1 ,u 2 ,v 2 ,…,u n ,v n ),y=g 2 (u 1 ,v 1 ,u 2 ,v 2 ,…,u n ,v n ), z = g 3 (u 1 ,v 1 ,u 2 ,v 2 ,…,u n ,v n ), realize the pixel coordinates of any point on N cameras (u i ,v i ) to the world coordinates (x, y, z) of the same point in space, and finally completes the calibration of the camera.
[0013] Furthermore, in step S1, the world coordinates (x, y, z) and pixel coordinates (u, v) of each positioning point are calculated, including the following steps:
[0014] S11, defining the specifications of the calibration plate, including the number of grids on the calibration plate and the size of each grid;
[0015] S12, define the calibration plate to be located on the z=0 plane of the world coordinate system, and the upper left corner of the calibration plate to be the origin (0,0,0);
[0016] S13. Calculate the coordinates of the corner points of each grid, that is, the world coordinates (x, y, z) of the positioning point, specifically:
[0017] The horizontal coordinate x = n × grid width, where n is the number of grids from the left, i.e. starting from 0;
[0018] The vertical coordinate y = m × grid height, where m is the number of grids from the top, i.e. starting from 0;
[0019] The z coordinate is determined according to the direction and distance of each calibration plate movement. Starting from the z = 0 plane, the side close to the camera is negative and the side far from the camera is positive.
[0020] S14. Use a camera to take a picture of the calibration plate to obtain the world coordinates (x, y, z) of the positioning point and the pixel coordinates (u, v) on the corresponding image plane.
[0021] Furthermore, in step S2, the expression of the calibration model f(x) is:
[0022]
[0023] K(x i ,x)=φ(x i )·φ(x)
[0024] In the above formula, α i and are all Lagrange multipliers; K(x i ,x) is a kernel function used to calculate the inner product between two vectors in high-dimensional space; φ(x i ) is the input sample x i The mapping in the high-dimensional feature space, x i represents a vector; φ(x) is the nonlinear mapping of the input sample x in the feature space; b is the bias term.
[0025] Furthermore, in step S2, the specific process includes the following steps:
[0026] S21. Define the original objective function of the support vector regression algorithm, namely:
[0027]
[0028] In the above formula, w is the weight vector of the calibration model; Used to characterize the maximum interval; b is the bias term; ξ i and is a slack variable used to measure the prediction error; C is a regularization parameter that controls the trade-off between model complexity and error term; N is the number of data points i;
[0029] S22, by introducing the Lagrange multiplier α i and Construct the Lagrangian function and transform the original problem of solving the support vector regression algorithm into a dual problem, namely:
[0030]
[0031] In the above formula, φ(x i ) is the input sample x i The mapping in the high-dimensional feature space, x i represents a vector; ∈ is the tolerable error range, called ∈-insensitivity interval; y i is the true value of the i-th sample; η i , All are Lagrange multipliers;
[0032] S23, for w, b, ξ i and Take the partial derivative and set it to zero to get the weight vector w;
[0033] S24, substituting the original objective function and the constraints of the dual problem into the objective function of the dual problem;
[0034] S25. Solve the dual problem to obtain the optimal Lagrange multiplier α used to construct the regression function f(x) i and Right now:
[0035]
[0036] S26. Using an optimization algorithm to solve the regression function f(x) to obtain the final regression function f(x), that is, the calibration model.
[0037] Further, in step S23, the weight vector w is expressed as:
[0038]
[0039] In the above formula, α i and are all Lagrange multipliers; φ(x i ) is the input sample x i The mapping in the high-dimensional feature space, x i represents a vector; N is the number of data points i.
[0040] Furthermore, in step S24, the objective function of the dual problem is:
[0041]
[0042] In the above formula, K(x i ,x j ) is the Gaussian kernel function, x i ,x j are the i-th and j-th input vectors respectively; α j , are all Lagrange multipliers.
[0043] Furthermore, in step S24, the constraint conditions of the even problem are:
[0044]
[0045] 0≤α i ≤C
[0046]
[0047] In the above formula, C is the regularization parameter, which controls the trade-off between model complexity and error term; N is the number of data points i.
[0048] By means of the above technical solution, the present invention provides a camera calibration method based on a support vector regression model, which has at least the following beneficial effects:
[0049] 1. The camera calibration method proposed in the present invention can not only improve the calibration accuracy, but also avoid the problem of overfitting, and has high practical value. It can be applied to monocular camera calibration, multi-camera calibration, and multiple calibration scenes such as chessboard and double-layer calibration plates.
[0050] 2. The present invention uses a support vector regression model to implement linear regression in high-dimensional space, so that nonlinear fitting can be performed on data in low-dimensional space; at the same time, the shooting angles of multiple cameras are used to jointly participate in the calculation of three-dimensional space coordinate points to improve fitting accuracy.
[0051] 3. The present invention can adapt to calibration scenarios in various environments, has good generalization ability and robustness. The more data, the more accurate the model. Compared with traditional calibration methods, the generalization ability and robustness have been significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0053] Figure 1 A schematic diagram of forming pixel coordinates on an image captured by the camera of the present invention;
[0054] Figure 2 The diagram is a principle diagram of mapping world coordinates to pixel coordinates of the present invention;
[0055] Figure 3 This is a schematic diagram of the mapping principle from pixel coordinates to world coordinates of the present invention. DETAILED DESCRIPTION
[0056] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific implementation methods, so that the implementation process of how the present application uses technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly.
[0057] The existing camera calibration methods mainly include those based on the pinhole imaging model (Zhang Zhengyou calibration) and the polynomial model. Both methods find the correspondence between the image pixel coordinates and the world coordinates, and then solve the camera parameters through optimization methods such as least squares method and gradient descent.
[0058] Compared with the existing technology, please refer to Figure 1-Figure 3This embodiment proposes a camera calibration method based on a support vector regression model. The support vector regression model is used to implement linear regression in high-dimensional space, so that nonlinear fitting can be performed on data in low-dimensional space; at the same time, the shooting angles of multiple cameras are used to jointly participate in the calculation of three-dimensional space coordinate points to improve the fitting accuracy; therefore, it can adapt to calibration scenarios in various environments, with good generalization ability and robustness. The more data, the more accurate the model. The method includes the following steps:
[0059] S1. Set up N cameras and shoot the same spatial area. Place the same calibration plate multiple times in this spatial area and move it parallel to the depth direction multiple times. Select any of the calibration plates placed as the reference to establish a world coordinate system. Calculate the world coordinates (x, y, z) of each positioning point based on the world coordinate system and the pixel coordinates (u, v) of each positioning point after being photographed by each camera according to the specifications of the calibration plate. Calculating the world coordinates (x, y, z) and pixel coordinates (u, v) of each positioning point includes the following steps:
[0060] S11. Define the specifications of the calibration plate, including the number of grids on the calibration plate and the size of each grid; for example, there are 10 grids in the horizontal direction and 7 grids in the vertical direction on the calibration plate, and the size of each grid is 10 mm×10 mm.
[0061] S12, define the calibration plate to be located on the z=0 plane of the world coordinate system, and the upper left corner of the calibration plate to be the origin (0,0,0);
[0062] S13. Calculate the coordinates of the corner points of each grid, that is, the world coordinates (x, y, z) of the positioning point, specifically:
[0063] The horizontal coordinate x = n × grid width, where n is the number of grids from the left, i.e. starting from 0;
[0064] The vertical coordinate y = m × grid height, where m is the number of grids from the top, i.e. starting from 0;
[0065] The z coordinate is determined according to the direction and distance of each calibration plate movement. Starting from the z = 0 plane, the side close to the camera is negative and the side far from the camera is positive.
[0066] S14. Use a camera to take a picture of the calibration plate to obtain the world coordinates (x, y, z) of the positioning point and the pixel coordinates (u, v) on the corresponding image plane.
[0067] S2. Based on the support vector regression algorithm, a calibration model f(x) is constructed to jointly determine the three-dimensional space coordinates by combining the shooting angles of N cameras. The core idea of the present invention is to use support vector regression (SVR) with a Gaussian kernel function (also known as a radial basis function kernel) to fit the coordinate transformation function f(x), realize the mutual mapping between two-dimensional pixel coordinates and three-dimensional world coordinates, and analyze the fitting effect of the model through reprojection error and mean square error.
[0068] Whether it is converting 2D coordinates to 3D coordinates or 3D coordinates to 2D coordinates, the SVR algorithm is expected to find a function f(x) that makes the error between the predicted value and the true value within an allowable range ∈, while trying to maximize the interval between all points and the segmentation hyperplane. The final regression function form can be expressed as:
[0069] y i =w·φ(x i )+b
[0070] Among them, w is the weight vector; b is the bias; φ(x i ) is the input sample x i The mapping in the high-dimensional feature space, x i Represents a vector, such as for the fitting function y=g 2 (u 1 ,v 1 ,u 2 ,v 2 ,…,u i ,v i ), x i Indicates (u 1 ,v 1 ,u 2 ,v 2 ,…,u i ,v i ), x i It has the same meaning in other fitting functions.
[0071] When using the support vector regression (SVR) model to map three-dimensional coordinates to two-dimensional coordinates, the goal is to minimize the prediction error. The core ideas of support vector machines (SVM) and support vector regression (SVR) are similar, both of which maximize the margin, which means that we hope to find a model that makes the data points as far away from the decision boundary (or regression line) as possible. Maximizing the margin can improve the generalization ability of the model, that is, it can still maintain good prediction performance on unseen data.
[0072] In the regression problem, the goal of SVR is to find a function f(x)=wT φ(x)+b, so that most of the data points fall within the allowable range of this function ∈-insensitive pipeline, while the complexity of the model is minimized by introducing the regularization term To characterize the maximum interval. In step S2, the specific process includes the following steps:
[0073] S21. Define the original objective function of the support vector regression algorithm, namely:
[0074]
[0075] In the above formula, w is the weight vector of the calibration model; Used to characterize the maximum interval; b is the bias term; ξ i and is a slack variable used to measure the prediction error; C is a regularization parameter that controls the trade-off between model complexity and error term; N is the number of data points i.
[0076] In the original optimization problem, the nonlinear mapping φ(x) may have high or even infinite dimensions, which makes it infeasible to directly solve the original problem. Therefore, the original problem can be transformed into a dual problem, using the Gaussian kernel function K(x i ,x j ) calculates the inner product of data points in high-dimensional space without explicit nonlinear mapping. This greatly simplifies the calculation process and makes it possible to deal with nonlinear problems in high-dimensional space.
[0077] In order to facilitate the solution, the SVR problem is usually transformed into the Lagrangian dual form. By introducing the Lagrangian multiplier α i and Construct the Lagrangian function.
[0078] S22, by introducing the Lagrange multiplier α i and Construct the Lagrangian function and transform the original problem of solving the support vector regression algorithm into a dual problem, namely:
[0079]
[0080] In the above formula, φ(x i ) is the input sample x i The mapping in the high-dimensional feature space, x i represents a vector; ∈ is the tolerable error range, called ∈-insensitivity interval; y i is the true value of the i-th sample; η i , α i and are Lagrange multipliers; among them, α,α *The Lagrange multiplier is related to the ∈-insensitive interval loss in SVR and is used to control the prediction error within a given range, while η,η * The Lagrange multipliers are associated with the non-negativity constraints on the slack variables, ensuring that the slack variables (representing the allowed error) cannot take negative values.
[0081] S23, for w, b, ξ i and Find the partial derivative and set it to zero to get the weight vector w. That is, according to the solution of the dual problem, the weight vector w can be expressed as:
[0082]
[0083] S24. Substitute the original objective function and the constraints of the dual problem to obtain the objective function of the dual problem, that is:
[0084]
[0085]
[0086] In the above formula, K(x i ,x j ) is the Gaussian kernel function, x i ,x j are the i-th and j-th input vectors respectively; α j , are all Lagrange multipliers; among them, α i , α j , are Lagrange multipliers. i and j are used to represent different indexes, which is convenient for defining and calculating the relationship between all sample pairs. i , α j , are respectively related to the sample x i ,x j The associated Lagrange multiplier.
[0087] The constraints of the dual problem are:
[0088]
[0089] 0≤α i ≤C
[0090]
[0091] In the above formula, C is the regularization parameter, which controls the trade-off between model complexity and error term; N is the number of data points i.
[0092] S25. Solve the dual problem to obtain the optimal Lagrange multiplier α used to construct the regression function f(x) i and Right now:
[0093]
[0094] Among them, only the support vector (i.e., α i or Non-zero samples) will contribute to the regression function f(x). Non-support vectors (i.e., α i and All zero samples) will not affect the prediction results of the regression function.
[0095] S26. Use an optimization algorithm to solve the regression function f(x) to obtain the final regression function f(x), that is, the calibration model. Different calibration scenarios have different parameter values to ensure that the model achieves the optimal effect.
[0096] The expression of the calibration model f(x) is:
[0097]
[0098] K(x i ,x)=φ(x i )·φ(x)
[0099] In the above formula, α i and are all Lagrange multipliers; K(x i ,x) is a kernel function used to calculate the inner product between two vectors in high-dimensional space; φ(x i ) is the input sample x i The mapping in the high-dimensional feature space, x i represents a vector; φ(x) is the nonlinear mapping of the input sample x in the feature space; b is the bias term.
[0100] Among them, the optimization algorithm is used to solve the regression function f(x) to obtain the final Lagrange multiplier α i and As well as the weight vector w and the bias term b, specifically:
[0101] Initialization parameter α i and Calculate the objective function value and gradient; update parameters using iterative optimization ideas; iterate until the objective function converges; calculate the final Lagrange multiplier α i and As well as the weight vector w and the bias term b.
[0102] This embodiment uses the support vector regression algorithm with Gaussian radial basis kernel to construct the calibration model f(x), which can more accurately fit the nonlinear functional relationship between two-dimensional and three-dimensional, thereby achieving higher-precision camera calibration. Compared with the traditional pinhole imaging model and polynomial model, the reprojection error of the present invention is smaller, the modeling is more accurate, the fitting effect is better, and overfitting can be avoided.
[0103] S3. According to the world coordinates (x, y, z) and pixel coordinates (u, v), the calibration model f(x) is used to fit two functions u=f for each of the N cameras. 1 (x, y, z) and v = f 2 (x, y, z), realizes the mapping of the world coordinates (x, y, z) of any point in space to the pixel coordinates (u, v) on N cameras; Figure 2 As shown, the world coordinates (x, y, z) and pixel coordinates (u, v) calculated in step S1 are used to fit two functions u = f using the calibration model f(x). 1 (x, y, z) and v = f 2 (x, y, z), realizing the conversion of the world coordinates (x, y, z) of any point in space to the pixel coordinates (u, v) on N cameras, thereby realizing the mapping of three-dimensional coordinates to two-dimensional coordinates.
[0104] S4. Select any camera 1 from N cameras as the reference camera, select any positioning point in camera 1, and find the three-dimensional coordinates (x, y, z) corresponding to the positioning point according to the world coordinates (x, y, z) and pixel coordinates (u, v). i ,y i ,z i ) and the corresponding pixel coordinates in other cameras (u i ,v i );like Figure 1 As shown in the figure, for a certain positioning point, after being captured by each camera, a pixel coordinate (u i ,v i ).
[0105] S5, use the calibration model f(x) to calibrate the pixel coordinates (u 1 ,v 1 ), and fit the pixel coordinates (u i ,v i ) between the mapping relationship (u i ,v i ) = f' 1 (u 1 ,v 1 ) and (u 1 ,v 1 ) = f'2 (u i ,v i ), to realize the pixel coordinates (u i ,v i ) and the pixel coordinates of the corresponding point on camera 1 (u 1 ,v 1 ) are mutually mapped. Figure 3 As shown in the figure, for the mapping of any positioning point in camera 1 and the z coordinate of the positioning point, the calibration model f(x) is used to fit the pixel coordinate (u) of any point in camera 1. 1 ,v 1 ) and the pixel coordinates (u 2 ,v 2 ) between the mapping relationship (u 2 ,v 2 )=f(u 1 ,v 1 ,z i ); that is, any point in camera 1 can be used to locate a point with the same position and features in camera 2. Similarly, the fitting relationship between camera 1 and cameras 3 and 4 is similar. Therefore, the world coordinates of any camera plane and a z-plane coordinate can be used to calculate the pixel coordinates of another plane through the calibration model f(x).
[0106] S6, using the calibration model f(x) and the mapping relationship (u i ,v i ) = f' 1 (u 1 ,v 1 ) and (u 1 ,v 1 ) = f' 2 (u i ,v i ), fitting the pixel coordinates (u 1 ,v 1 ) to world coordinates (x, y, z) 1 (u 1 ,v 1 ,u 2 ,v 2 ,…,u i ,v i ),y=g 2 (u 1 ,v 1 ,u 2 ,v 2 ,…,u i ,v i ), z = g 3 (u 1 ,v1 ,u 2 ,v 2 ,…,u i ,v i ), realize the pixel coordinates of any point on N cameras (u i ,v i ) to the world coordinates (x, y, z) of the same point in space, and finally complete the calibration of the camera, where u i ,v i represents the pixel coordinates of the i-th camera (u i ,v i ). Therefore, we get three functions x=g 1 (u 1 ,v 1 ,u 2 ,v 2 ,…,u i ,v i ),y=g 2 (u 1 ,v 1 ,u 2 ,v 2 ,…,u i ,v i ), z = g 3 (u 1 ,v 1 ,u 2 ,v 2 ,…,u i ,v i ) After that, by selecting a point in space with coordinates (x, y, z), we can get the projection (u i ,v i ). On the contrary, select any point on camera i (u i ,v i ), we can get the coordinates of the same point in other cameras (u j ,v j ), and then the world coordinates (x, y, z) are obtained according to the pixel coordinates (u, v) values of all cameras through the calibration model f(x), thereby completing higher-precision camera calibration.
[0107] The present invention uses mean square error (MSE) and reprojection error (ED) to evaluate the accuracy of the camera calibration method. The mean square error (MSE) is:
[0108]
[0109] Where n is the number of data points; y true,i is the true pixel coordinate of the ith data point; y pred,i is the predicted pixel coordinate of the ith data point.
[0110] The reprojection error (Euclidean Distance) is:
[0111]
[0112] Among them, y u,test and v,test is the pixel coordinate in the test set (true value); y u,pred and v,pred are the predicted pixel coordinates.
[0113] This embodiment tests the pinhole imaging model (Zhang Zhengyou calibration), the method based on the polynomial model, and the camera calibration method proposed in the present invention, and the specific test results are shown in Table 1:
[0114] Table 1 Test results of accuracy of different calibration methods
[0115]
[0116] From the test results in Table 1, it can be seen that the camera calibration method based on support vector machine proposed in the present invention can not only improve the calibration accuracy, but also avoid the problem of overfitting, and has high practical value. It can be applied to single-target calibration and multi-camera calibration, and multiple calibration scenes such as checkerboard and double-layer calibration plates.
[0117] The camera calibration method proposed in the present invention does not require a large amount of training data. It only needs to identify the positioning points through multiple calibration plate pictures, establish a connection between the pixel coordinates (u, v) of the images taken by multiple cameras and the world coordinates (x, y, z) corresponding to the position of the calibration plate in the real world, and then fit a (u, v) = f(x, y, z) nonlinear function relationship to achieve the mapping of three-dimensional coordinates to two-dimensional coordinates. Compared with the traditional calibration method, the generalization ability and robustness are significantly improved.
[0118] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, so the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0119] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the above embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0120] The above implementation methods have been described in detail. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A camera calibration method based on a support vector regression model, characterized in that: The method comprises the following steps: S1. Set up N cameras and shoot the same spatial area. Place the same calibration plate multiple times in this spatial area and move it parallel to the depth direction multiple times. Select any of the calibration plates placed as the reference to establish a world coordinate system. Calculate the world coordinates (x, y, z) of each positioning point based on the world coordinate system and the pixel coordinates (u, v) of each positioning point after being photographed by each camera according to the specifications of the calibration plate. S2. Based on the support vector regression algorithm, a calibration model f(x) is constructed to jointly determine the three-dimensional space coordinates by combining the shooting angles of N cameras; S3. According to the world coordinates (x, y, z) and pixel coordinates (u, v), the calibration model f(x) is used to fit two functions u=f1(x, y, z) and v=f2(x, y, z) for N cameras to achieve the mapping of the world coordinates (x, y, z) of any point in space to the pixel coordinates (u, v) on N cameras. S4. Select any camera 1 from N cameras as the reference camera, select any positioning point in camera 1, and find the three-dimensional coordinates (x, y, z) corresponding to the positioning point according to the world coordinates (x, y, z) and pixel coordinates (u, v). i ,y i ,z i ) and the corresponding pixel coordinates in other cameras (u i ,v i ); S5. Using the calibration model f(x), for the pixel coordinates (u1, v1) of any point in Camera 1, fit the mapping relationship between the pixel coordinates (u i , v i ) of any other Camera i, i.e., (u i , v i ) = f'1(u1, v1) and (u1, v1) = f'2(u i , v i ), to achieve the mutual mapping between the pixel coordinates (u i , v i ) of any point in any Camera i and the pixel coordinates (u1, v1) of the corresponding point on Camera 1; S6. Using the calibration model f(x) and the mapping relationships (u i , v i ) = f'1(u1, v1) and (u1, v1) = f'2(u i , v i ), fit three functions x = g1(u1, v1, u2, v2, …, u i , v i ), y = g2(u1, v1, u2, v2, …, u i , v i ), z = g3(u1, v1, u2, v2, …, u i , v i ) for mapping the pixel coordinates (u i , v i ) of any point on N cameras to the world coordinates (x, y, z) of the same point in space, and finally complete the calibration of the cameras.
2. The camera calibration method according to claim 1, characterized in that: In step S1, the world coordinates (x, y, z) and pixel coordinates (u, v) of each positioning point are calculated, including the following steps: S11, defining the specifications of the calibration plate, including the number of grids on the calibration plate and the size of each grid; S12, define the calibration plate to be located on the z=0 plane of the world coordinate system, and the upper left corner of the calibration plate to be the origin (0,0,0); S13. Calculate the coordinates of the corner points of each grid, that is, the world coordinates (x, y, z) of the positioning point, specifically: The horizontal coordinate x = n × grid width, where n is the number of grids from the left, i.e. starting from 0; The vertical coordinate y = m × grid height, where m is the number of grids from the top, i.e. starting from 0; The z coordinate is determined according to the direction and distance of each calibration plate movement. Starting from the z = 0 plane, the side close to the camera is negative and the side far from the camera is positive. S14. Use a camera to take a picture of the calibration plate to obtain the world coordinates (x, y, z) of the positioning point and the pixel coordinates (u, v) on the corresponding image plane.
3. The camera calibration method according to claim 1, characterized in that: In step S2, the expression of the calibration model f(x) is: K(x i ,x)=φ(x i )·φ(x) In the above formula, α i and are all Lagrange multipliers; K(x i ,x) is a kernel function used to calculate the inner product between two vectors in high-dimensional space; φ(x i ) is the input sample x i The mapping in the high-dimensional feature space, x i represents a vector; φ(x) is the nonlinear mapping of the input sample x in the feature space; b is the bias term.
4. The camera calibration method according to claim 1, characterized in that: In step S2, the specific process includes the following steps: S21. Define the original objective function of the support vector regression algorithm, namely: In the above formula, w is the weight vector of the calibration model; Used to characterize the maximum interval; b is the bias term; ξ i and is a slack variable used to measure the prediction error; C is a regularization parameter that controls the trade-off between model complexity and error term; N is the number of data points i; S22, by introducing the Lagrange multiplier α i and Construct the Lagrangian function and transform the original problem of solving the support vector regression algorithm into a dual problem, namely: In the above formula, φ(x i ) is the input sample x i The mapping in the high-dimensional feature space, x i represents a vector; ∈ is the tolerable error range, called ∈-insensitivity interval; y i is the true value of the i-th sample; η i , All are Lagrange multipliers; S23, for w, b, ξ i and Take the partial derivative and set it to zero to get the weight vector w; S24, substituting the original objective function and the constraints of the dual problem into the objective function of the dual problem; S25. Solve the dual problem to obtain the optimal Lagrange multiplier α used to construct the regression function f(x) i and Right now: S26. Use an optimization algorithm to solve the regression function f(x) to obtain the final regression function f(x), that is, the calibration model f9x).
5. The camera calibration method according to claim 4, characterized in that: In step S23, the weight vector w is expressed as: In the above formula, α i and are all Lagrange multipliers; φ(x i ) is the input sample x i The mapping in the high-dimensional feature space, x i represents a vector; N is the number of data points i.
6. The camera calibration method according to claim 4, characterized in that: In step S24, the objective function of the dual problem is: In the above formula, K9x i ,x j ) is the Gaussian kernel function, x i ,x j are the i-th and j-th input vectors respectively; α j , are all Lagrange multipliers.
7. The camera calibration method according to claim 4, characterized in that: In step S24, the constraints of the even problem are: 0≤α i ≤C In the above formula, C is the regularization parameter, which controls the trade-off between model complexity and error term; N is the number of data points i.