apple / ARKitScenes

This repo accompanies the research paper, ARKitScenes - A Diverse Real-World Dataset for 3D Indoor Scene Understanding Using Mobile RGB-D Data and contains the data, scripts to visualize and process assets, and training code described in our paper.
Other
662 stars 58 forks source link

.traj Rotation Format #37

Closed jianglh-WHU closed 2 years ago

jianglh-WHU commented 2 years ago

hello,I wanna know the I want to know whether the order of rotating Euler angles is xyz, and whether the coordinate system is w2c

nileshkulkarni commented 2 years ago

Hi @jianglh-WHU, How are you reading the .traj files, I'm sorry I couldn't find any documentation for reading them. Thanks!

M-G-A commented 2 years ago

@nileshkulkarni You can find the code in the TenFpsDataLoader


        with open(traj_file) as f:
            self.traj = f.readlines()
        # convert traj to json dict
        poses_from_traj = {}
        for line in self.traj:
            traj_timestamp = line.split(" ")[0]
            poses_from_traj[f"{round(float(traj_timestamp), 3):.3f}"] = TrajStringToMatrix(line)[1].tolist()```
M-G-A commented 2 years ago

@jianglh-WHU as you can read in the code in the function convert_angle_axis_to_matrix3 cv2.Rodrigues is used, hence if you want to have Euler angels you have to convert the orientation yourself. I.e converting the matrix:

from scipy.spatial.transform import Rotation as R
R.from_matrix( rot_matrix ).as_euler('xyz',degrees=True)

The function provided by apple for creating the matrix from euler angles eulerAnglesToRotationMatrix uses xyz-order

jianglh-WHU commented 2 years ago

Hi @jianglh-WHU, How are you reading the .traj files, I'm sorry I couldn't find any documentation for reading them. Thanks!

https://github.com/apple/ARKitScenes/blob/main/DATA.md Hey,maybe this can help you~

jianglh-WHU commented 2 years ago

@jianglh-WHU as you can read in the code in the function convert_angle_axis_to_matrix3 cv2.Rodrigues is used, hence if you want to have Euler angels you have to convert the orientation yourself. I.e converting the matrix:

from scipy.spatial.transform import Rotation as R
R.from_matrix( rot_matrix ).as_euler('xyz',degrees=True)

The function provided by apple for creating the matrix from euler angles eulerAnglesToRotationMatrix uses xyz-order

I got it,thank you.But I still want to know whether the coordinate system is w2c(world to camera)

M-G-A commented 2 years ago

@jianglh-WHU you can get this information by reading the function generate_point. In it, points in the camera frame get transformed into the world frame by applying the translation and rotation (combined as a homogeneous 4x4 matrix). So it should be cam2world.

PeterZheFu commented 2 years ago

Thanks @M-G-A and @jianglh-WHU. I will close the issue for now. Feel free to re-open it if you have any further questions.

cmakcay commented 1 year ago

@jianglh-WHU you can get this information by reading the function generate_point. In it, points in the camera frame get transformed into the world frame by applying the translation and rotation (combined as a homogeneous 4x4 matrix). So it should be cam2world.

Hi, the reasoning is logical but there is an inversion here, and they named the rotation "r_w_to_p". So, the rotations in the .traj files should be world to camera, not camera to world.