Zhang Zhengyu Calibration algorithm theory and algorithm implementation

Source: Internet
Author: User

Zhang Zhengyu Calibration algorithm theory and algorithm implementation

Theoretical Basis

In 1999, Zhang Zhengyu of Microsoft Research presented a camera calibration method based on mobile plane template. This method is a method between the traditional calibration method and the self-calibration method, although the traditional calibration method is high precision equipment, the operation process is more cumbersome, the accuracy of self-calibration method is not high, Zhang Zhengyu calibration algorithm overcomes the shortcomings of both the advantages of both, so the office, The Desktop Vision System (DVS) is suitable for use in family situations.


The points of the coordinates in the three-dimensional world are: and the points of the two-dimensional camera plane coordinates are:


To facilitate the operation, the template is defined in the plane of the world coordinate system parallel to the X-y plane (i.e., z=0), which is the homogeneous coordinate of the point on the template plane, and the point projected on the plane of the template to the corresponding point on the image plane. Is the camera's reference matrix. The rotation and the shift matrices are recorded as R, T, and scaling factor scalar as s.


Depending on the nature of the rotation matrix, constraints can be obtained for each pair of images:

(a)

based on matrix knowledge, when the number of images taken is greater than or equal to 3 when it contains 5 a matrix of unknown internal parameters A can be The only solution.


The B -matrix is a symmetric matrix, so it can be written as a six-dimensional vector form:

(b)

We take the column vectors of the H matrix as:


Type (b) to be rewritten as:


Finally, according to the restriction formula (a) of the internal parameters:


The Matrix V is a 2x6 matrix, that is, each picture can be set up two equations, containing six unknowns. Based on the knowledge of linear algebra, it is necessary to require at least six equations to solve all unknowns, so that it takes at least three photos to solve all unknowns. b After the solution, you can solve the camera reference matrix A, and then solve the external parameters of each image R, T:


which

Maximum likelihood estimation and radial distortion processing

(1) Maximum likelihood estimation

When the initial parameters have been solved, the control points of each image are restored to the three-dimensional world coordinates according to the solved parameters, and then the difference between the solution value and the real value is optimized by establishing the nonlinear minimization model, namely:


The optimal parameters can be obtained by using this model combined with LM optimization algorithm.

(2) Treatment of radial distortion

This model is built to take into account the distortion of the lens, but generally the camera will have a certain degree of radial deformity. Here we only consider two times distortion.

Set (U, v) as the ideal pixel coordinate for the actual pixel coordinates. Corresponds to, (x, y) and for ideal and actual image coordinates. So there are:


Among them, K1 and K2 are radial distortion coefficients. The same applies for center point distortion. Then by and we get the following formula:


It is known that the M-point of the N-pair graph solves the solution of this linear equation by least squares method. Once the K1 and K2 have been obtained, they can be used to optimize other parameters through the processing of the maximum likelihood formula. by repeatedly replacing the two processes until you are satisfied.

In addition, the obtained distortion coefficients can also be optimized by maximum likelihood estimation, the formula is:


implementation of Zhang Zhengyu calibration algorithm

First of all, for the Zhang Zhengyu algorithm of the standard point selection, it is generally selected to be evenly distributed throughout the image of some points. For the calibration accuracy of the camera, the more points are chosen, the more complete the information of the reaction image is, and the better the result will be. However, with the increase of the number of points, the increase in the computation, while increasing the amount of points resulting in increased accuracy with the increase in points and gradually weakened. Therefore, the Zhang Zhengyu algorithm usually chooses 10 points evenly distributed on the image . In this experiment, six images from different angles were taken from the same camera, and 10 feature points were taken from each image to calibrate the camera (the world coordinates of these 10 points are the same). The figure shows these six images, each with a size of 384x512.



The specific process is:

1) Transpose the world coordinates (homogeneous coordinates) of the 10 points taken.

2) solve and optimize the single-response matrix.

3) after solving the single-matrix of six graphs, the 6 vectors (b-matrices) are solved. Because each single-matrix can get two equations, by looping the matrix Y assignment, and then orthogonal decomposition of y to get 6 vectors. The camera's internal reference matrix is then obtained.

4) The external parameters of the camera are solved first, then the distortion coefficients are solved, and the camera coordinates (XC, Yc, Zc) are obtained.

5) Call the function to optimize the internal and distortion coefficients and display the optimized results. Then, the external parameter matrix is solved according to the optimized results.

6) The independent variable (three coordinate angle) is decomposed from the rotation matrix, then the translation matrix is obtained and finally optimized with the internal reference and distortion coefficients.

******************

hao_09

Date: 2015/8/13

Article Address: http://blog.csdn.net/lsh_2013/article/details/47617909

******************











Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Zhang Zhengyu Calibration algorithm theory and algorithm implementation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.