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)?


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.

  • $\begingroup$ I think you misunderstood me: I understand (to some limited extent:) how the vector of 5 ratios was yielded in the least mean squares sense. What I don't understand is how to yield the full rotation and translation matrices from the 5 ratios. $\endgroup$ – Yuval Weissler Apr 12 '17 at 6:24
  • $\begingroup$ You can search for "Rotation matrix to Euler angles'. Two caveats: 1, there are many conventions for your rotation (XYZ is what you pasted, but you can have any combination of X,Y, and Z, as long as the same letter does not appears next to itself - XYX is fine, but XXY is not). 2, the angles given by a rotation matrix are not unique. You might get the same rotation matrix by rotating extra 180 degrees along one axis, followed by one or two 90 degrees along different axis $\endgroup$ – Andrei Apr 12 '17 at 14:53
  • $\begingroup$ I've search for rotation matrix decomposition, but not much luck... all the decomposition I've found assume a compete rotation matrix, and I'm still at a stage of trying to piece together mine. Also, as far I understand, the rotation matrix I've pasted is the common matrix to describe the rotation of the camera along 3 distinct axes, but I'm not sure, and I'd appreciate confirmation. $\endgroup$ – Yuval Weissler Apr 13 '17 at 5:17
  • $\begingroup$ In your notation, let's assume that $0\le \beta \le \pi$. Then $\cos \beta\ge 0$, and you can find it from $\cos \beta=\sqrt{1-\sin^2\beta}=\sqrt{1-r_{13}^2}$. Now you can calculate $\cos \gamma$ and $\sin \gamma$ by dividing $r_{11}$ and $r_{12}$ by $\cos \beta$. You can use $atan2$ function to get $\gamma$. From the second row, you can now find $\sin \alpha$ and $\cos\alpha$ $\endgroup$ – Andrei Apr 13 '17 at 6:33
  • $\begingroup$ Unfortunately, r13 is unknown - only the 5 ratios in the original post. I also tried to analyze the rotation matrix elements in Wolfram Alpha. Still doesn't get me closer to the solution. $\endgroup$ – Yuval Weissler Apr 13 '17 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.