Skip to content

A WIP rust crate to parse c3d, a motion caption file format.

Notifications You must be signed in to change notification settings

extraymond/c3d-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Readme

This is a c3d file format parser/reader written in rust. C3d is a biomechanics data format wildly used in the field of motion cpature.

The parser is written with the guidance of the c3d.org specification and the python parser from py-c3d.

features

  1. Currently parsing only.
  2. After reading the header/parameter block, because the adapter implements the iterator trait, you can read the (frame_index, points_data, analog_data) without needing to copy all the data section upfront.
  3. Error estimation and camera observation information are correctly parsed according to the specification.
  4. When consuming the reader, the analog data will be offset and scaled individulally/globally if the corresponding parameter is set.

usage

use c3d_rs::C3dAdapter;

let mut file = File::open("somefile")?;

let mut buf: Vec<u8> = vec![];
file.read_to_end(&mut buf)?;

let mut cursor = Cursor::new(buf)

/// adapter accepts impl Read + Seek.
let adapter = C3dAdapter::new(&mut file)?.construct()?;
let adapter = C3dAdapter::new(&mut buf[..])?.construct()?;


/// read labels into Vec<String> with whitespace stripped.
let point_labels: Vec<String> = adapter.get_points_labels().unwrap();
let adapter_labels: Vec<String> = adapter.get_adapter_labels().unwrap();

/// reading (frame, ponts, analog) from iterator
for (frame_idx, points_data, optional_analog_data) in adapter.reader()?.into_iter() {

}

/// working with vendor specific parameter.
let param = adapter.parameter.unwrap().get("GROUP:PARAMETER").unwrap();

About

A WIP rust crate to parse c3d, a motion caption file format.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages