Skip to content

Instantly share code, notes, and snippets.

@daitomanabe
Created June 2, 2023 03:28
Show Gist options
  • Save daitomanabe/c366ee6fc9368370a1b9c21b3dc5b67f to your computer and use it in GitHub Desktop.
Save daitomanabe/c366ee6fc9368370a1b9c21b3dc5b67f to your computer and use it in GitHub Desktop.
bvh_to_csv
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