magicleap / Atlas

Atlas: End-to-End 3D Scene Reconstruction from Posed Images
Apache License 2.0
1.82k stars 221 forks source link

Format of Pose in 0000000*.txt in DATAROOT/sample/sample1/pose/ #7

Closed Suraj520 closed 4 years ago

Suraj520 commented 4 years ago

Hi @zmurez ; Could you please discuss the format of data in each rgb corresponding pose's text file in DATAROOT/sample/sample1/pose/ ?

For example : 00000001.txt contains 6.208292841911315918e-01 -2.021953016519546509e-01 7.574220299720764160e-01 5.417202062606811808e+00 -7.820422649383544922e-01 -9.244704246520996094e-02 6.163306236267089844e-01 4.002395458221435831e+00 -5.459773540496826172e-02 -9.749721288681030273e-01 -2.155191004276275635e-01 2.021697369813919121e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+00

zmurez commented 4 years ago

This is the 4x4 pose matrix. It is composed of the rotation R matrix and translation vector T: [R, T] (with T in meters). The camera extrinsics matrix (which maps world coordinates to camera coordinates) is the inverse of the pose matrix.

We use a right handed coordinate system where the world is z-up (gravity is along the z axis), while the camera is (x-right, y-down, z-forward, same as opencv)

Maverick054 commented 4 years ago

@zmurez could you please elaborate on the values present in the pose.txt file. What does each value stand for?

zmurez commented 4 years ago

Here is a reference https://www.learnopencv.com/geometry-of-image-formation/

let P be the pose matrix in the .txt file, and K be the 3x3 intrinscis matrix. (note that inverse(P) is the extrinsics matrix) Then for a point X=(x,y,z,1) in homogeneous world coordinates, it gets mapped to a pixel in the image q=(u,v,1) according to K @ inverse(P)[:3,:] @ X (where @ is matrix multiplication)

Hope this helps

watarungurunnn commented 2 years ago

@zmurez Thank you for the information. Could you tell me how to convert bpy.context.scene.camera.matrix_world into the pose matrix for Atlas? https://docs.blender.org/api/current/bpy.types.Object.html#bpy.types.Object.matrix_world