Closed jianglh-WHU closed 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!
@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()```
@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
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 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)
@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.
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.
@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.
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