Created
June 2, 2023 03:28
-
-
Save daitomanabe/c366ee6fc9368370a1b9c21b3dc5b67f to your computer and use it in GitHub Desktop.
bvh_to_csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from bvh import Bvh | |
with open('your_file.bvh') as f: | |
mocap = Bvh(f.read()) | |
with open('output.csv', 'w', newline='') as f: | |
writer = csv.writer(f) | |
writer.writerow(['Frame', 'Rotation_X', 'Rotation_Y', 'Rotation_Z']) | |
for i in range(mocap.nframes): | |
rotation = mocap.joint_rotation('Hips', i) | |
writer.writerow([i] + rotation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment