ZHANG’S METHOD
The zhang’s method relies in getting a series of n images of a chessboard patterns where are known
- number of internal corners of the pattern, different in the 2 directions
- size of squares of the pattern
from this images the goal is to extract the matrix parameters:
flowchart TD A[Acquire n images of a planar pattern \n with m internal corners]; B[For each such image compute an initial \n guess for homography Hi]; C[Refine each Hi by minimizing \n the reprojection error]; D[Get an initial guess for A given the homographies Hi]; E[Given A and Hi , get an initial guess for Ri and T]; F[Compute an initial guess for lens distortion parameters k]; G[Refine all parameters A, Ri, Ti, k by minimizing the reprojection error]; A-->B B-->C C-->D D-->E E-->F F-->G
GETTING CORNERS IMAGE COORDINATES
Corners can be detected easily from the image by using the Harris detector
SETTING A WRF
so given a set of images the WRF is taken with origin at the top-left corner of the patter(that could easily be detected)
Given this setup with the WRF parallel to the axis we can consider the control point to have so the relation with the image points became a HOMOGRAPHY
MAKING A GUESS FOR
so given a pattern with corners it’s possible to write sets of 3 linear equations where 2D and 3D coordinates are known so we can compute the matrix
So extracting the vector from the system:
From this system in 3 equations in 9 unknowns only 2 equation are linear independent, the last one is discarded. For each image a system of equations is built in order to minimize the algebraic error due to the norm of minimizing the problem
Now the solution to this system can be found with singular value decomposition (SVD) of matrix
REFINING
In order to minimize the reprojection error is chosen by the following non linear minimization problem:
The way the reprojection error is minimized is by comparing the output of the matrix with the actual image coordinates and minimizing the squared error, the error minimized is also called the geometric error this can be done by the Levenberg-Marquardt algorithm
MAKING A GUESS FOR
With the previous knowledge it can be said that between and the exists the following relation
Given that is an orthogonal matrix the following relations are true
In this equation the unknowns are given the fact that is upper-triangular turns out to be symmetric so the unknowns are just
So given the following definitions
So the following relation is true
So each image gives 2 independent equations in 6 unknowns for the system which can be solved by the SVD
MAKING A GUESS FOR AND
Now that can be guessed the extrinsic parameter of the can be computed so given the previous equation
so because is a unit vector:
can be computed in the same way:
can be derived by exploiting orthogonality
Finally can be computed from the vector
MAKING A GUESS FOR THE DISTORTION PARAMETERS
At this point the un-distorted coordinates can be calculated from the matrix and the distorted coordinates can be recovered by the image, so given the lens distortion model:
And a Taylor approximation of the non linear function:
And the relation between distorted and ideal coordinates
The distortion parameters can be computed with a linear system of equations
REFINING ALL PARAMETERS
There is the need to refine all the parameter found in order to minimize the reprojection error, again this can be achieved by an optimization problem where the objective function is
The solution to this problem can be computed with Levenberg-Marquardt algorithm