I'm working on an AR program. I have done this steps:
- Detect corners of a chess board with OpenCV
- Use SolvePNP to find rvec and tvec
- Apply Rodrigues on rvec to get R_mat
- Use
hconcat(R_mat, tvec, P);
to concatenate R_mat and tvec to get Projection matrix - Apply
decomposeProjectionMatrix
on P to get new translation,T2, vector and eulerAngles
now my problem is in translation vectors just tvec[2] or translation over Z-axis is correct
and in rotations again in Euler Angles (from decomposeProjectionMatrix
) just eulerAngles[2] or rotation around z-axis is correct.
I don't know hoa can I get Translation and Rotation related to X-axis and Y-axis correctly.
I'm gonna use these in OpenGL to Augment a cube on the pattern.
In my code, result of translation over X and Y axis is very larger than windows size; and rotaion around X and Y axis are very small and always near the zero (less than 0.0001)
Any Idea how to get correct meaningful T and R? P.S : I'm using an Identity matrix as camera matrix and zero matrix for dist coeff matrix.