title: Biovision Hierarchical File (BVH) Euler angle specification differences
body: <h1>Problem</h1>
  
  <p>I am trying to get features out of a BVH file by parsing it. The BVH file is exported through <a href="http://nuicapture.com/" rel="nofollow noreferrer">NUICapture</a>, a software that captures body movement through Kinect.</p>
  
  <p>All BVH example files I know specify the Euler angles in <code>ZXY</code> notation, not <code>ZYX</code>, but NUICapture exports BVH files using the <code>ZYX</code> notation, so I'm having trouble parsing it.</p>
  
  <h1>Background</h1>
  
  <p>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, <code>ZXY</code> is not the same as <code>ZYX</code>.</p>
  
  <h1>Attempts at Solution</h1>
  
  <p>All the existing parsers I came across are denoting <code>ZXY</code> 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 <a href="http://bvhacker.com/" rel="nofollow noreferrer">BVHhacker</a>. 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.</p>
  
  <p>I tried taking an open-source Python BVH parser such as <a href="https://sites.google.com/a/cgspeed.com/cgspeed/bvhplay" rel="nofollow noreferrer">BVHPlay</a> 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" <code>ZXY</code> 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.</p>