[Math] Find Rotation and Translation Matrix

matricesrotations

I've read a paper on a proposed algorithm to calibrate a camera for intrinsic and extrinsic parameters.

First step of the algorithm is to estimate the rotation and translation of camera relative to the test grid, which can be expressed in the following way:

enter image description here

The author then proposes that after solving an over determined set of linear equations, one gets a set of 5 ratios from which one may fully get the rotation and translation matrix.

enter image description here

enter image description here

Unless I'm missing something, I can't understand how.
Some assistance\pointers please?

P.S –

I know I'm directed to another article, but right now I'm out of my budget to purchase it, and I'm assuming the solution to my question is relatively simple.

EDIT:
I infer from what the author wrote that he suggests that the 6 unknowns in the 5 ratios can be solved because 4 out of the 6 are elements in the same rotation matrix, which all depend on the same 3 angles of rotation – which means that you can substitute the 4 unknowns rotation elements with 3 unknown angles, which gives you 5 unknowns for 5 equations.

Some typical googling brought what I think to be a standard model of the rotation matrix which depends on 3 rotation angles (can someone verify this?):

enter image description here

Is this the right direction? Is there a way to get the 3 rotation angles from this model and the equations in (8)?

Best Answer

In the equation above (8), the author obviously chooses $Z_W=0$. Then $$x(r_{21}X_W+r_{22}Y_W+t_y)=y(r_{11}X_W+r_{12}Y_W+t_x)\\ xt_y=yr_{11}X_W+yr_{12}Y_W+yt_x-xr_{21}X_W-xr_{22}Y_W\\ x=yX_Wr_{11}/t_y+yY_Wr_{12}/t_y+yt_x/t_y-xX_Wr_{21}/t_y-xY_Wr_{22}/t_y \ (*)$$

This last equation holds (approximately) for any $(x,y,X_W,Y_W)$ control points. Assuming that everything is perfect, you get a $5\times5$ matrix by taking any $5$ control points, and that matrix is invertible if the points are independent. You multiply (8) on the left with the inverse, and you get the vector of $r_{11}/t_y, ...$

In reality your measurements are not perfect, so you do many (more than 5). Equation (*) becomes $x_i=y_iX_{Wi}r_{11}/t_y+y_iY_{Wi}r_{12}/t_y+y_it_x/t_y-x_iX_{Wi}r_{21}/t_y-x_iY_{Wi}r_{22}/t_y$, where $i$ takes values from $1$ to $n$. What you want in this problem is choose the values for $r_{11}/t_y, ...$ that make all these equation almost be true. The least squares approach means that you minimize $$S=\sum_i(y_iX_{Wi}r_{11}/t_y+y_iY_{Wi}r_{12}/t_y+y_it_x/t_y-x_iX_{Wi}r_{21}/t_y-x_iY_{Wi}r_{22}/t_y-x_i)^2$$
To do that, you have five equations like $$\frac{\partial S}{\partial (r_{11}/t_y)}=0$$ and the like, for all your variables. The above equation becomes $$\sum_i(2 y_iX_{Wi})(y_iX_{Wi}r_{11}/t_y+y_iY_{Wi}r_{12}/t_y+y_it_x/t_y-x_iX_{Wi}r_{21}/t_y-x_iY_{Wi}r_{22}/t_y-x_i)=0$$or$$r_{11}/t_y\sum_i y_i^2X_{Wi}^2+r_{12}/t_y\sum_iy_i^2X_{Wi}Y_{Wi}+t_x/t_y\sum_i y_i^2X_{Wi}-r_{21}/t_y\sum_i x_iy_iX_{Wi}^2-r_{22}/t_y\sum_i x_iy_iX_{Wi}Y_{Wi}-\sum_i x_i y_iX_{Wi}=0$$ When you write all equations, you get a simple linear system of five equations with five unknowns.