Meshroom
Meshroom copied to clipboard
Camera rotation and translation in Meshroom-2023
The photogrammetry pipeline outputs cameras rotation and translation recovered from input images - either in cameras.sfm or their inverts in
In this issue, unrelated to my question, someone, however, says:
I think the reference frame convention has been changed between two releases, so if you used different versions, it could explain it. Maybe @servantftechnicolor has some better insight."
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
def render(pmesh,f,cx,cy,rotmat,tvec):
# rotation by 180 around X
Rx = np.array([[1, 0, 0],
[0, -1, 0],
[0, 0, -1]])
# homogeneous matrix
real_pose = np.eye(4,dtype=float)
real_pose[:3,:3] = Rx @ rotmat
real_pose[:3, 3] = Rx @ tvec
real_pose = np.linalg.inv(real_pose)
# setup cam
real_cam = pyrender.IntrinsicsCamera(f,f,cx,cy)
light = pyrender.PointLight(color=np.ones(3), intensity=10.0)
scene = pyrender.Scene()
obj_node = scene.add(pmesh)
cam_node = scene.add(real_cam, pose=real_pose)
point_l= scene.add(light, pose=real_pose)
# render
r = pyrender.OffscreenRenderer(viewport_width=cx*2, viewport_height=cy*2)
color, depth = r.render(scene)
return color
Desktop (please complete the following and other pertinent information):
- OS: linux suse
- Python version 3.9
- Meshroom versions:
- 2021.1.0
- 2023.2.0