Closed yuliaar closed 2 weeks ago
Would be great to get any reply to this!
Hello.
.sfm contains, historically, for each pose:
the associated homogeneous matrix avcamera_T_avworld is
avcamera_T_avworld = [avcamera_R_avworld -avworld_R_avcamera.transpose()avworld_t_avcamera; 0 1] avcamera_T_avworld = [avcamera_R_avworld -avcamera_T_avworld avworld_t_avcamera; 0 1]
but this is using the classical vision geometric system, which is X to the right, Z to the back, Y to the bottom.
The opengl convention is X to the right, Z to the front, Y to the top. so this is a 180 degrees rotation on axis X, or, in matrix form :
gl_T_av = [1 0 0 0; 0 -1 0 0; 0 0 -1 0; 0 0 0 1]
Now, the difference between 2021 and 2023 is that in 2021 .obj where exported in vision coordinates system and in 2023 the mesh is exported in graphics coordinates system.
So you have to multiply on both side the transformation now :
GLcamera_T_GLworld = gl_T_av avcamera_T_avworld av_T_gl GLcamera_T_GLworld = gl_T_av avcamera_T_avworld gl_T_av (symmetric matrix)
Tl/dr : Comparing with your code, i think the difference is that you have to post multiply your rotation with Rx ( Rx @ rotmat @ Rx)
Thanks, it has solved it.
The photogrammetry pipeline outputs cameras rotation and translation recovered from input images - either in cameras.sfm or their inverts in_KRt.txt files. Previously I have successfully used camera transforms recovered by Meshroom-2021 for 2D rendering with pyrender and similar openGL based renderers (it only required an additional 180 degrees rotation around x applied to Meshroom rotation matrix). Reading up on changes in Meshroom-2023 it looked like this version of Meshroom would align its coordinate frame with the openGL convention, so I expected that the only difference in how camera transforms should be applied would that the rotation around x does not need to be added during rendering. However, it is not like that at all, and I cannot figure out how to apply the camera transform produced by Meshroom 2023 to the mesh produced by Meshroom 2023 to achieve the correct 2D rendering.
In this issue, unrelated to my question, someone, however, says:
This is exactly what I would like to know, how the camera transform matrices have changed so I could amend my rendering code accordingly.
The render function below correctly works with texturedMesh.obj and_KRt.txt files produced by Meshroom 2021 but failes with files produced Meshroom 2023 (also fails without additional rotation Rx).
Desktop (please complete the following and other pertinent information):