facebookresearch/fairmotion

ASF/AMC to BVH conversion

vittorione94 opened this issue · 1 comments

Hello,

I'm trying to convert the attached asf/ amc files (from the CMU dataset) to bvh. However the output bvh euler angles don't match the input ones. I'm trying to load the animation in MuJoCo similarly to what has been done here: parse_amc but for bvh.

I've also attached a script that prints the possible euler angles from the transformation matrix for a joint in the first frame, (as a newbie) I would expect one of the conversions to match almost perfectly the amc data. But since it doesn't I think I don't fully understand the conversions so any hint/help would be fantastic!

In the same script I also made a check with conversions from dm_control and they match.

asf_amc.zip
angle_checks.py.zip

Thanks in advance for your time,
-Vittorio

I think I've found why the euler angles don't match:

In

joint.matrix = joint.C.dot(conversions.E2R(joint.degree)).dot(

  1. E2R uses an extrinsic rotations format when initialising an euler angle, so I created a new function E2R_intrinsic and used that one.
  2. After implementing point 1 most of the joints already match but others like rhumerus or lhumerus are completely off. The issue comes from joint.Cinv which I don't fully understand. I guess everything boils down to why when setting a joint rotation matrix we do CRC^-1?

Anyhow when replacing the product CRC^-1 with just R the joint angles match perfectly. However now that the joint angles match when I save a bvh file using those and try to load it back in the visualizer the mocap is broken.

I'm confused I thought that in both file formats the mocap was saved as euler angles per joint, so I would expect that after defining the skeletons the joint angles should match to some extent.... am I missing something very basic?

I've attached the generated bvh file.

fairmotion_processed.zip

Thanks in advance for your help!