Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can the preprocessed data converted to quaternions? #34

Open
Ammola opened this issue Sep 7, 2018 · 5 comments
Open

Can the preprocessed data converted to quaternions? #34

Ammola opened this issue Sep 7, 2018 · 5 comments
Labels

Comments

@Ammola
Copy link

Ammola commented Sep 7, 2018

May I ask you @una-dinosauria a question?

Can the preprocessed data be converted to quaternions instead of exponential maps?
Is there a code for the conversion?
I would be very thankful to you if you can provide me with the same data you used but represented with quaternions instead of exponential maps.

Sorry If I'm asking the wrong question.

@una-dinosauria
Copy link
Owner

Can the preprocessed data be converted to quaternions instead of exponential maps?

Yes.

Is there a code for the conversion?

Look at https://github.com/una-dinosauria/human-motion-prediction/blob/master/src/data_utils.py. We have code to convert from expmat to rotation matrix, and then you can go from rotation matrix to quaternion.

I would be very thankful to you if you can provide me with the same data you used but represented with quaternions instead of exponential maps.

I don't usually write code for others, but I'm happy to give pointers to resources that will help you accomplish what you want.

Cheers,

@Ammola
Copy link
Author

Ammola commented Sep 9, 2018

Thank you very much @una-dinosauria you're very helpful and very responsive.
I did write some code for conversion before reading your answer :)
I asked the question because I have no clue which values to be converted (angles) and which values to left without conversion (translation values).

From some comments here I realized that the first three values from every row are translation values (so these should not be considered in the conversion) while all other values should be converted.
Because every angle will be represented as four quaternions, after the conversion every frame becomes 131 D vector (correct me If I'm wrong please).

To make sure that I did it correctly, I converted the angles back to exponential maps to see If I will get the original angles, and I got very similar values (with little differences).
I'm sure my code is very basic and has lots of room for improvement :)
If you don't mind I will post the code here to get comments from experts like you.

Thanks again :) @una-dinosauria .

@una-dinosauria
Copy link
Owner

From some comments here I realized that the first three values from every row are translation values (so these should not be considered in the conversion) while all other values should be converted.
Because every angle will be represented as four quaternions, after the conversion every frame becomes 131 D vector (correct me If I'm wrong please).

It should be 3 + 4*(n_joints). This sounds good to me.

o make sure that I did it correctly, I converted the angles back to exponential maps to see If I will get the original angles, and I got very similar values (with little differences).
I'm sure my code is very basic and has lots of room for improvement :)
If you don't mind I will post the code here to get comments from experts like you.

If you can convert back and forth, the program is probably correct. You may want to implement forward kinematics from quaternions and verify that you obtain the same result.

@Ammola
Copy link
Author

Ammola commented Sep 10, 2018

Thanks @una-dinosauria
I will try to implement FK from quaternions.
I need to understand the meanings of values in each frame (the 99-long vector).
I know that the first three values are 3D positions of the root and the following three values are 3D rotations of the root, but I don't know how the rest of the angles are ordered.
What is the structure of the skeleton in the H3.6M?
Is it the same as that used in BioVision and AMC/ASF formats?
I've read their paper but there is nothing about the skeleton hierarchy.

@una-dinosauria
Copy link
Owner

Hi @Ammola,

What is the structure of the skeleton in the H3.6M?

Please have a look at the fkl function that we provide:

def fkl( angles, parent, offset, rotInd, expmapInd ):
"""
Convert joint angles and bone lenghts into the 3d points of a person.
Based on expmap2xyz.m, available at
https://github.com/asheshjain399/RNNexp/blob/7fc5a53292dc0f232867beb66c3a9ef845d705cb/structural_rnn/CRFProblems/H3.6m/mhmublv/Motion/exp2xyz.m
Args
angles: 99-long vector with 3d position and 3d joint angles in expmap format
parent: 32-long vector with parent-child relationships in the kinematic tree
offset: 96-long vector with bone lenghts
rotInd: 32-long list with indices into angles
expmapInd: 32-long list with indices into expmap angles
Returns
xyz: 32x3 3d points that represent a person in 3d space
"""

The parameters are all you need to understand the structure of the data, including rotation parameters and parent-child relations. You may want to look at https://en.wikipedia.org/wiki/Forward_kinematics to get familiar with the concepts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants