0

I am trying to make a BVH file out of a set of landmark position gotten out of MLKit. My problem is that currently, I'm not sure I have properly understood how BVH files are supposed to work.

I tried using this for the file specifications, however, it doesn't properly explain how to create a BVH file, whihc is to say, what exactly are the euler angles? Are they between the first ever frame and the current one or between 2 different ones?

The other problem is the formula to get said angles. My current algorithm is

for all landmark position:
  u = vector representing the bone (landmark to next landmark in hierarchy)
  v = vector representing previous bone in hierarchy
  q = quaternion between u and v
  return euler from q

However, this is not working at all. I also tried making sense of this repo but no luck either.

Edit: For clarification, MLKit produces an array of (x,y,z) positions each frame following this model: MLKit skeleton

I transform the skeleton to one that is more commonly used in humanoid animation: Generalized skeleton

So my goal is to make a BVH file after recording each nodes' positions. I know that I need to create a set of euler angles in the order they appear in each channel in the hierarchy, the question however is how to get said angles following the hierarchy. Angles are always between 2 things, so the first question is which 2 things are compared:

  • Bone with parent bone?
  • Bone with previous bone's position?
  • Bone with it's position in the first part of the BVH (hierarchy)?

Overall, what I need is the mathematical formula that would transform my points into euler angles that follows the BVH specifiactions.

Mlaisne
  • 1
  • 3
  • see [How to parse a bvh file to a skeleton model made in OpenGL?](https://stackoverflow.com/a/52699028/2521214) beware you have to have correct euller angles order – Spektre Jul 12 '22 at 07:35
  • The link you provided is parsing a bvh file, my goal is to make one. – Mlaisne Jul 13 '22 at 09:05
  • I was aware of that but parsing and creating BVH file is similar... However no one can provide you with anything better as you did not provide any input data/info you are dealing with nor code, nor exact description of the problem ... `is not working at all` is not a problem description – Spektre Jul 13 '22 at 10:33

1 Answers1

0

The example file they provide within the file specification link you added can provide some clarity.

It starts with the HIERARCHY which contains channels, like:

CHANNELS 3 Zrotation Xrotation Yrotation

There are a total of 57 channels.

Below the hierarchy it tells you that there are two frame (aka keyframes), and 0.033333 seconds between those frames (30 fps)

Frames:    2
Frame Time: 0.033333

Then there are two lines of tab delimited data, with 57 values in each, matching the number of channels defined above. So each value matches a channel defined above.

aptriangle
  • 1,395
  • 1
  • 9
  • 11
  • That doesn't answer any of my questions, though? I was asking what the euler angles correponds to in the time aspect. Are they the euler angles needed to move the bone from its position in frame 0 to the one in the current frame or is it from frame n to frame n+1? – Mlaisne Jul 13 '22 at 08:50
  • They are the current angles of each rotation at the time of that frame. They are not relative. – aptriangle Jul 13 '22 at 10:56