bvh-converter
bvh-converter copied to clipboard
Precision not match
Hi! I've noticed something strange when learning from your code.
That is the output results have slightly different results then the original bvh file. I've found that when compared to a example file 06_01.bvh.zip, there are some frames that have different result.
[i for i,j in enumerate((original['Hips'] == converted['Hips'])) if False in j]
The following will have unequally result.
[7,17,25,41,58,62,66,73,102,108,114,150,156,163,206,228,237,257,274,326,331,345,347,393,394,450,454,456,457,479,481,489]
Although after further comparison, they both are float64 type data. Thus I believe the difference is made by precision of floating point.
I've tried to create a similar converter using sympy, and the precision gap indeed pay a noticeable difference.
This is the difference in root(Head) offset.
Ultimately, in the end segment(Head), the offset is relatively big. But overall, the results have similar pattern.
Thx for your patience.
In all honesty, I think that that imprecision is unavoidable to a certain extent in this conversion. The BVH file format is explicitly designed to not have precision issues and as soon as you start applying the matrix functions to it in order to decode the BVH frames into actual positions you will run into precision issues.
However, I could be entirely incorrect. Most of the math for this utility came from a different project (here https://sites.google.com/a/cgspeed.com/cgspeed/bvhplay) and I opted to trust the math being done there. It's been a while since I've had to use this utility and there could very well be issues with the conversion algorithm. I'd have to do a decent amount of research to discover where that error is coming from and I don't have a project right now that's requiring that effort so I don't think I'm going to do it. If you do decide to research the issues and PR a fix I'd be more than willing to accept it! Thanks for the report and good luck!
@tekulvw I will take a look at bvhplay! Thx for letting me know.
Just want to say thx again for this lib, it's really handy! I'll see what I can find.