text-to-motion
text-to-motion copied to clipboard
How can the output data be converted to bvh format?
I'm trying to convert the rotations and joint position into bvh format so that I can do better visualization. I can see that there is an IK method in the motion_process.py file which might help me to get the local rotation information. But it turns out that it's not correct. I fed in the joint positions returned by recover_from_ric method.
Would be appreciate if any help or hint is provided.
Hi, I tried many times to visualize the results in bvh format but failed. I feel it is more complicated than I suppose. So I will be glad if you can figure it out. As far as I know, bvh is in "euler angle" rotation representation.
Use the following code:
from common.skeleton import Skeleton import numpy as np import os from common.quaternion import * from utils.paramUtil import *
example_data = np.load(os.path.join(data_dir, example_id + '.npy')) example_data = example_data.reshape(len(example_data), -1, 3) example_data = torch.from_numpy(example_data) skel = Skeleton(n_raw_offsets, kinematic_chain, 'cpu') offsets = skel.get_offsets_joints(example_data[0])
face_joint_indx = [2, 1, 17, 16] quat_params = skel.inverse_kinematics_np(example_data, face_joint_indx, smooth_forward=False)
Then the quat_params are the local rotations in quaternion representation. Note the root rotations are respect to Z+ direction. Hope it helps.
Thank you very much for the reply! Quick question on the example data, is it the global or local position of the joints? What would the first entry be like?
Hi, the example data use global positions of joints. It is in the same format as what you obtained through recover_from_ric method. You may also need to add these two lines:
n_raw_offsets = torch.from_numpy(t2m_raw_offsets) kinematic_chain = t2m_kinematic_chain
So this quat_params give you the local rotations of each bone with respect to the pre-defined offsets.
Hello! has this problem been solved? Can you share the method with me?
Converting the SMPL pose to BVH was easy, and I got that done yesterday.
Converting the SMPL pose to BVH was easy, and I got that done yesterday.
Hello! Could you share the method with me? Thank you very much!
Converting the SMPL pose to BVH was easy, and I got that done yesterday.
Hi, if possible, could you please send the code or github repos? I am very interested. Thanks.