Skip to main content

Motion capture conversion utilities.

Project description

mocap-converter

PyPI - Version PyPI - Python Version

mocap-converter is a library for turning motion-capture recordings into formats that downstream tools can reuse. It converts joint position traces captured during a mocap session into joint rotation data, making it easy to repurpose captured motion in other contexts.

Installation

Install with uv:

$ uv add mocap-converter

Or install with pip:

$ pip install mocap-converter

Usage

Convert Azure Kinect Data to BVH

The snippet below loads Azure Kinect Body Tracking data exported by the Offline Processor, derives joint rotations from the recorded global joint positions, and saves the result as a BVH animation.

import json

from mocap_converter.adapter.azure_kinect import (
    AZURE_KINECT_KINEMATIC_TREE,
    get_positions_from_json,
)
from mocap_converter.adjust_kinematic_tree import adjust_kinematic_tree
from mocap_converter.io.bvh.saver import save_bvh
from mocap_converter.motion_data import MotionData
from mocap_converter.pos2rot import get_rotations_from_positions


with open("path/to/kinect_capture.json") as raw:
    kinect_data = json.load(raw)

positions = get_positions_from_json(kinect_data)
# Apply optional smoothing (e.g., a median filter) here if the capture contains noisy frames.
kinematic_tree = adjust_kinematic_tree(AZURE_KINECT_KINEMATIC_TREE, positions)
root = kinematic_tree.root

positional_motion = MotionData(kinematic_tree, positions)
rotations = get_rotations_from_positions(positional_motion, current_node_name=root.name)

rotational_motion = MotionData(
    kinematic_tree,
    positions={root.name: positions[root.name]},
    rotations=rotations,
)

save_bvh(rotational_motion, "path/to/output.bvh")

License

mocap-converter is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mocap_converter-0.0.1.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mocap_converter-0.0.1-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file mocap_converter-0.0.1.tar.gz.

File metadata

  • Download URL: mocap_converter-0.0.1.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mocap_converter-0.0.1.tar.gz
Algorithm Hash digest
SHA256 63120b466a04d9c59a12d9bf3d8152a2b1d82623d538a06f58c6571a4c2e0dc3
MD5 5f5ea6be6fe36f546077a6218a6fd00f
BLAKE2b-256 5affe055df05c45f6aadbf0eead0f8fe92301b0912e53ae6afb9fcd1ee707168

See more details on using hashes here.

Provenance

The following attestation bundles were made for mocap_converter-0.0.1.tar.gz:

Publisher: publish.yml on yukihiroK/mocap-converter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mocap_converter-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mocap_converter-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fbda9c3c77924d8daa5eea94409e419af829431bc8a9b77373f54d886e5528b4
MD5 5c4cc63abde943135b89ea8ef3f77059
BLAKE2b-256 b93c760a18d38623e4176bbe420c5c322dd60313b6c40d627975a12f51380f6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mocap_converter-0.0.1-py3-none-any.whl:

Publisher: publish.yml on yukihiroK/mocap-converter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page