Wrong rotation matrix from XMP export?
Dear all,
we are trying to retrieve the camera track from a reconstruction, in world (model) coordinates. We did a controlled movement with the camera, that is almost linear in position and with a rotation around the vertical axis.
The reconstruction was good and the camera track shown in RC follows exactly what we did in the footage.
In the "Component 0 / Camera poses" tree we can see all the pictures (with a crazy order...?), looking for the first one, we can see the position and the orientation.
We then export the camera track in XMP.
The positions are exactly what we can see in the "Camera poses" tree, and is coherent with what we expect. When comes to orientation, however, there is a problem.
The "Camera poses" shown for the first camera is yaw = 65°, pitch = 2°, roll = -175°: this is expected, the model is rotated upside down (the camera is rolled ~180°), there is almost no pitch and an amount of yaw. The last camera is yaw = 102°, pitch = 1.7°, roll = -178°. This is expected, there is almost no movement in pitch and roll, while there is almost 40° of orizontal (yaw) movement.
Exporting in XMP, however, while the position is correct, the rotation matrix of the first frame (RPY = 65, 2, -175) is:
0.907810936889714 -0.413802986606466 -0.0681644418959641
0.0455549380885757 -0.0642752926939784 0.996891886999212
-0.416898129618214 -0.908094584844923 -0.0394990442436559
while I would expect something like (e.g., using this tool: http://danceswithcode.net/engineeringnotes/rotations_in_3d/demo3D/rotations_in_3d_tool.html):
0.4223 0.9015 -0.0937
0.9057 -0.4238 0.0053
-0.0349 -0.0872 -0.9956
Also transforming the yaw/pitch/roll in RC into a quaternion and viewing it into Blender shows a rotation around the orizontal axis (roll) that should not be there (and no yaw).
The strange thing is that if I multiply the inverse of the RC-exported matrix of the first frame times the matrix of the last frame, it shows a rotation around the Z (world) axis, as expected.
Should I do something to export the right rotation matrix, as seen in RC view?
-
After a lot of random tests, I have the feeling that the words "yaw, pitch and roll" in RC have a different meaning with respect to what is commonly used elsewhere. It seems like yaw is around the Y axis of the camera, pitch around its X axis and roll around its Z axis or, in other words, that the camera is not oriented with -Z pointing towards the framed scene and Y oriented in the up direction (e.g., OpenGL notation), but as it has the X axis pointing towards the scene and Z up. In this way, the matrix multiplications I am doing are completely screwed up.
If this is true, what should I do to position a commonly camera (OpenGL notation) in the 3D world using the matrix exported in XMP files?
Please sign in to leave a comment.
Comments
2 comments