0

I am trying to use the Quaternion form instead of rotation matrices.

I already trained my model, but when I need to test the model, I must compute Euler angles from the Quaternion form as this person did with computing Euler angles from rotation matrices.

For example, the output in Quaternion form for B = batch_size = 2 (-> Bx4) is :

tensor([[ 0.0725, -0.0645,  0.0308,  0.9948],
        [-0.5235, -0.2456,  0.0824,  0.8117]], device='cuda:0')

And, the output in rotation matrices form for B = batch_size = 2 (-> Bx3x3) :

tensor([[[ 0.9933, -0.0871,  0.0755],
         [ 0.0850,  0.9959,  0.0316],
         [-0.0779, -0.0250,  0.9966]],

        [[ 0.7244, -0.0551, -0.6871],
         [ 0.2493,  0.9503,  0.1866],
         [ 0.6427, -0.3065,  0.7021]]], device='cuda:0')

Note: this is output for batch_size; it is not one frame or one image.

Could you help me with how we can compute Euler angles from Quaternion form?

Redhwan
  • 927
  • 1
  • 9
  • 24
  • I would recommend this paper [1], the authors detail conventions when using 3d rotations and and provide a codebase for reference [2]. [1] https://iopscience.iop.org/article/10.1088/0965-0393/23/8/083501/meta [2] https://github.com/marcdegraef/3Drotations – Paddy Harrison May 01 '23 at 08:02
  • 1
    you could try adapting from the answers to [this question](https://stackoverflow.com/questions/56207448), which contains the basic equations for quaternion to euler transformaition – Hoodlum May 01 '23 at 08:03

0 Answers0