views:

91

answers:

2

I am working with some code which outputs a 3x3 rotation matrix and a translation vector representing a cameras orientation and location.

However, the documentation states that to get the location of the camera one must multiply the transposed and inverted rotation matrix by the translation vector. Does that mean that the original vector is not the location of the camera? If not, what does that original vector represent?

A: 

The original vector in this case is probably the translation vector in the coordinates after the translation. Or maybe before - it all depends on your personal point of view.

The thing is, you have two coordinate systems, and every vector can be represented in each of coordinate systems. The rotation matrix allows you to transform things from one system to the other. The "multiply the transposed and inverted rotation matrix by" thing is the backward transformation.

AVB
What are the two coordinate systems, camera and world? If so, in camera space wouldn't the translation vector simply be zero?
freakTheMighty
Camera and world - very probably yes. Rotation cannot change the length of a vector - so if there is any translation, it will be non-zero in all spaces.
AVB
Sorry, I don't understand how the camera's location could be non-zero in camera space. By definition isn't the origin in camera space the location of the camera?
freakTheMighty
I didn't say that the camera's location can be non-zero in camera space. But the translation vector is meaningful in camera space too - it points to the world origin relative to the camera.
AVB
+4  A: 

I'm assuming that the R (rotation matrix) and t (the translation vector) you obtained were w.r.t a world coordinate system with (0,0,0) as the origin.

With R and t you can now move a point from the world coordinate system (WC) to the camera coordinate system (CC), i.e. Xc = RX + t where X is a 3D point in WC and Xc is X in CC (i.e. seen from the camera's point of view). This is applicable assuming we're dealing with rigid bodies so we just rotate the point and then translate it.

Now, you need to find the coordinates of the camera center which is the origin of CC, or when Xc = 0:

0 = RC + t where C is the 3D coordinates of the camera center in WC. By solving for C we get,

C = -R-1t

And by the way,

A correction in your documentation

Transposing and multiplying the rotation matrix does not change the rotation matrix --- a rotation matrix is orthogonal which means it's transpose is equal to its inverse and therefore, (RT)-1 = R.

Jacob