4

Problem

I am trying to get features out of a BVH file by parsing it. The BVH file is exported through NUICapture, a software that captures body movement through Kinect.

All BVH example files I know specify the Euler angles in ZXY notation, not ZYX, but NUICapture exports BVH files using the ZYX notation, so I'm having trouble parsing it.

Background

In the BVH format, the sequence of the axes may be different due to Euler angles specified for each body part. The rotation of a body part is specified by matrix multiplication of the axes specified, and movement of the entire body is taken as the product of the rotations of all successive body parts in the hierarchy. Since matrix multiplication is not commutative, ZXY is not the same as ZYX.

Attempts at Solution

All the existing parsers I came across are denoting ZXY as the de facto standard, and all papers too. None of the parsers I found is able to parse the BVH file produced by NUICapture, with the exception of BVHhacker. But BVHhacker does not have source code available, and so even though it seems to be able to replay the motion captured by NUICapture, there is no access to the internal representation created by BVHhacker's parser.

I tried taking an open-source Python BVH parser such as BVHPlay and try to import the NUICapture's BVH file, but there is a file input error, which does not occur with other sample BVH files with the "correct" ZXY format. To solve this, I need to correct the axes sequence somehow but I am not sure how to do it without affecting the integrity of the original body motion. To me, it may be quite naïve just to switch the order manually to allow the BVH to be parsed.

Seanny123
  • 8,776
  • 13
  • 68
  • 124
user2391299
  • 41
  • 1
  • 3
  • Note that [BVHacker](https://github.com/DaveDubUK/bvhacker) is now open source and available on GitHub. – Seanny123 May 18 '17 at 05:27

2 Answers2

1

See the bottom of this page: http://research.cs.wisc.edu/graphics/Courses/cs-838-1999/Jeff/BVH.html As you can see, you premultiply by the inverse of rotation matrix for each axis, going in the opposite order, then (pre)multiply by the matrices in the correct order. So if you have R=XYZ, you premultiply R by X^(-1), then the result by Y^(-1), then multiply that result by X and then by Y, so that you end up with Y*X*Y^(-1)*X^(-1)*R.

Guesst
  • 11
  • 1
0

Er... it should be pretty straight-forward to apply the rotations in the correct order. ZXY is the de-facto standard, but the spec explicitly supports arbitrary orders.

If your using 3ds Max, we wrote a BVH parser for CAT waaaay back in the day, you can find it in "stdplugs\stdscripts\CATScripts\ImportBVH.ms". This script manually parsers BVH files and supports a variety of euler orders. I haven't looked at it in about 10 years so no guarantee of correctness; but the theory is fairly straight forward.

If your not using Max, yes, you can just change the order of multiplications. I'm not familiar with the referenced python app, but all's ya gotta do is

ZXY = rotMatrix(Z) * rotMatrix(X) * rotMatrix(Y)
ZYX = rotMatrix(Z) * rotMatrix(Y) * rotMatrix(X)

You can't change the values in the bvh file though, so you can't go into the file and just move values around to get the rotations in the ZXY order.

FrozenKiwi
  • 1,362
  • 13
  • 26