Feedback

What's your question?

By: Asked

How to get a camera in Maya from a Camera to World matrix?

Here's the camera data taken from the LightStage knight's head data set (source http://gl.ict.usc.edu/Data/LightStage/)

#focal length
24745.1 24731.5
#principal point
1962.85 1167.7
#distortion coeffs
1.19791 2.1775 -0.0168257 -0.0151422

#camera tranformation matrix - Camera to World
0.99767 0.0598546 0.0327442 6.13211 
-0.0584816 0.99743 -0.0413955 -13.0434 
-0.0351378 0.0393841 0.998606 433.477 
0 0 0 1 

So the main issue is the 4X4 matrix, although the focal length seems odd and ideas on using the principal point and the distortion coefficients would be welcome too.

I tried plugging the matrix into decomposeMatrix.mel

http://www.sigillarium.com/blog/lang/en/186/

but didn't get a camera that seemed usable, quite possibly because I'm still in the wrong coordinate system.

Any ideas?

Add comment viewed 523 times Latest activity 7 months ago

or Cancel

1 answer

  • 0

julian [ Admin ]

Looks like the translation components are in the last column instead of the last row, which is where maya would expect them to be. So the camera head gives a matrix in column-major order.

If you swap the columns for the rows you get this:

0.99767 -0.0584816 -0.0351378 0 
0.0598546  0.99743  0.0393841 0
0.0327442  -0.0413955  0.998606 0
6.13211 -13.0434 433.477  1

Not sure if that's right, but at least there's a translation now.

NN comments
michael_82
-

Thanks for the tip Julian, I’ll check it out.

michael_82
-

It’s looking at the origin now, so that’s better, although now the decomposed matrix is outputting a 3 degree z rotation which doesn’t seem right. Regarding the focal length, I set Camera Scale to 10 since I can’t have values above 3500 and that seems ok to do.

or Cancel