akanazawa / hmr

Project page for End-to-end Recovery of Human Shape and Pose
Other
1.55k stars 395 forks source link

how to get angle of 3d joints? #41

Closed aoguren closed 5 years ago

aoguren commented 5 years ago

hello @akanazawa , the render images is as follow, image how to get joints' (x, y, z) coordinates or angle of rotation, i want to use it to model human skeleton in maya.

joints, verts, cams, joints3d, theta = model.predict() I try to use joints3d to model it, but it is wrong. could you give me some suggest? thanks!

akanazawa commented 5 years ago

Hi @aoguren,

If you look at the demo code line 127, it returns joints3d, which is 1 x 19 x 3, holding the the (x, y, z) of 19 joints. It also returns theta, which is a 1 x 85 vector, which contains the joint rotations in axis angle format:

pose = theta[:, 3:75] # This is the 1 x 72 pose vector of SMPL, which is the rotation of 24 joints in axis angle format

You can get the 3x3 rotation matrices of the 24 joints by:

import cv2
rotations = [cv2.Rodrigues(aa)[0] for aa in pose.reshape(-1, 3)]

If you want to port it to Maya, you should check out SMPL for maya, included in the original SMPL release: http://smpl.is.tue.mpg.de/downloads

Best,

Angjoo

lyupei commented 5 years ago

@akanazawa I converted it to rotation matrices and I want to port it to unity to demonstrate the actions in real-time, but the unity support document of smpl model is quite short. I tried multi ways but can't get the same result as in opendr. Have you got any ideas how to implement this?

aalzooke commented 5 years ago

@akanazawa did you do it in real time, please share

akanazawa commented 5 years ago

Hi, I was not involved in the unity support of SMPL models, so I recommend asking the original authors for directions on this.

Best,

Angjoo