Ask Your Question

Rotation and Translation question

asked 2016-06-07 01:26:35 -0600

sourmanb gravatar image

I've used OpenCV's calibrateCamera function to give me the rvecs and tvecs to try to get the transformation from that of my camera with world coordinates (0,0,0) to that of a chessboard. I'm using it to find the corners of the chessboard with respect to the camera.

I'm confused as to how to apply the rvec and tvec to get the transformation. Do I just do (0,0,0)*rvec + tvec. If this is the case, how do I invert the transformation, as I'll need this for something else as well?

After doing research online I realized I may have to use the Rodrigues() function to get the rotation matrix from rvec, augment that with the tvec, and then add a row of (0,0,0,1) to get a 4x4 transformation matrix. This way, I would be able to get the inverse. However, If that is the case, how do I multiply that by (0,0,0)? Am I just supposed to do (0,0,0,1)*(rotm|tvec, 0,0,0,1)?

I'm not sure which of the two methods to use, I'm doubtful about how to proceed with either of them.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-06-08 05:28:48 -0600

AJW gravatar image

updated 2016-06-08 05:41:17 -0600

I'm not sure that I understand 100% what you're trying to do, but here goes.

(r,t) in this case represent a rigid transform that convert points from the chessboard coordinate system to the camera coordinate system (I don't know the convention for which one is the world coordinate system). You're right about needing the Rodrigues transform, but you have the multiplication order wrong. Say you use Rodrigues to get a rotation matrix R, and you have a point X=[x y z]^T in the chessboard coordinate system (X must be a column-vector). Then to express the point in the world coordinate system, you want R*X + t.

The approach of making the 4x4 matrix should also work. This is based on the concept of homogeneous coordinates (might help with Googling). You should be able to just invert that to get the inverse transformation. Again, the order matters. If P is the 4x4 matrix, it should be P*[0 0 0 1]^T(or whatever the vector is, and again, it must be a column vector).

You should also be able to obtain the inverse without homogeneous coordinates. Let's denote it (R',t'). I'm pretty sure R' = R^T (a rotation matrix is orthonormal, so its inverse is just the transpose). And t' = -R^T * t. You could even take both approaches and check that they give basically the same inverse.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-06-07 01:19:52 -0600

Seen: 2,311 times

Last updated: Jun 08 '16