Interpretation of Zhang Zhengyu calibration algorithm
Always wanted to write about the camera calibration aspects of things, the recent group will also talk about calibration aspects of things, so by the way to write. Whether it is OPENCV or matlab calibration box, are based on the Zhang Zhengyu Checkerboard calibration algorithm as the core realization, this article Pami "a flexible New technique for Camera calibration" has great influence, Zhang Zhengyu is a mechanical department of Zhejiang University, which seems to be a tenured professor of Microsoft now. I will simply introduce the core principle of the algorithm, the reasoning of the formula may be a bit more.
A basic problem Description: The mapping of three-dimensional point of space plane to two-dimensional point of camera plane.
Assume three-dimensional points in the space plane: (homogeneous coordinates, world coordinate system).
Camera plane Two-dimensional point: (homogeneous coordinates, camera coordinate system).
So how do the dots in space map to the camera plane? We use an equation to denote the relationship between the two:
(1)
Note: A is the camera's reference matrix, the r,t is a rotation and peace shift matrix, S is a scaling factor scalar.
Let's simplify the equation (1) again:
(2)
Because the Zhang Zhengyu algorithm chooses the plane calibration, so the z=0, so the translation vector only R1,R2 can be. H is what we often call the single-sex matrix , described here is the space of three-dimensional points and the camera plane two-dimensional point of the relationship between. Because the coordinates of the midpoint of the camera plane can be obtained by means of image processing (Harris corner point, then precise control point position based on gradient search), the three-dimensional points in the space plane can be obtained by the pre-made chessboard. So that means you can calculate an H matrix for each image.
Two control limits
We write the H matrix (3*3) as a 3-column vector, then we can write the H-matrix:
(3)
Note: Lamda is a scaling factor scalar and is also the reciprocal of S.
So now we're going to use a critical condition: R1 and R2 standard orthogonal.
Orthogonal: (4)
Unit vector (modulo equal): (5)
The two equations are very graceful, because they are perfectly linked to the absolute two-curve theory, and are not unfolded here.
The solution of three camera's internal reference
We make:
(6)
We know that the B matrix is a symmetric matrix, so it can be written as a 6-dimensional vector form:
(7)
We take the column vectors of the H matrix as:
(8)
So according to the equation (8) We rewrite the equation (4) into:
(9)
(10)
Finally, the constraints are based on the internal parameters (equation (4) (5)):
(11)
That is, (12)
The V matrix is a 2*6 matrix, which means that each photo can be set up with two equations and 6 unknowns. According to the knowledge of linear algebra, the solution of 6 unknowns requires at least 6 equations, so that means we need at least three photos to solve the unknown. The solution of the B matrix, the camera reference matrix A is also solved, so that the r,t of each image is solved according to the equation (1).
Four-parameter optimization
Since the initial parameters have been solved, we will re-project the control points of each image back to the three-dimensional space according to the solved parameters, and minimize the difference between the real values, in fact, is to establish a nonlinear minimization model:
(13)
The Levenberg-marquardt iterative algorithm is used here.
At this point, the whole process is finished, as for the camera distortion coefficient of the solution is not specifically launched.
Interpretation of Zhang Zhengyu camera calibration algorithm