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

Code to convert the 9 numbers in m['pose_N'][0,1] to (72,)==smpl.pose.shape? #39

Open
neonb88 opened this issue May 21, 2020 · 5 comments

Comments

@neonb88
Copy link

neonb88 commented May 21, 2020

Hi @bharat-b7 ,

I'm sure you are quite busy, but 10 minutes of your time could potentially save me hours. Is there code to convert the (3,3) numbers in m['pose_N'][0,1] to the 3 ((3,)) angles per joint (72 pose parameters) used by SMPL?

#24 (comment)

Thanks,
Nathan

@bharat-b7
Copy link
Owner

Hi, you can use the following to convert rotation matrix to vector. https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.html

I haven't tested but a combination of 'from_matrix()' and 'as_rotvec()' should do the job.

@neonb88
Copy link
Author

neonb88 commented May 21, 2020

@bharat-b7 Thanks! Will check it out. But does it deal with the issue of "dependent rotations" ? ie. I mean where global rotation of the wrist depends on local rotation of all joints "above" the wrist on the kinematic tree (ie. elbow, shoulder)?

@neonb88
Copy link
Author

neonb88 commented May 21, 2020

@bharat-b7 Thanks! Will check it out. But does it deal with the issue of "dependent rotations" ? ie. I mean where global rotation of the wrist depends on local rotation of all joints "above" the wrist on the kinematic tree (ie. elbow, shoulder)?

At least, this is an issue unless someone pre-defined the order of the rotations from out['pose_0'][0] to always be the same (ie. global rotates before back rotates before shoulder b4 elbow b4 wrist)

@neonb88 neonb88 closed this as completed May 21, 2020
@neonb88 neonb88 reopened this May 21, 2020
@hshreeshail
Copy link

Hi, you can use the following to convert rotation matrix to vector. https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.html

I haven't tested but a combination of 'from_matrix()' and 'as_rotvec()' should do the job.

Hi @neonb88, I am facing the same issue. Did this answer work for you? If not, could you please share what worked. Thanks in advance.

@hshreeshail
Copy link

Using the following worked for me

from scipy.spatial.transform import Rotation as R
r = R.from_matrix(rot_matrix).as_rotvec()

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

No branches or pull requests

3 participants