Giter Site home page Giter Site logo

amcparser's Introduction

AMCParser

A lightweight library to parse and visualize asf/amc files from CMU MoCap dataset using Python 3.

The main purpose of this library is to help understanding how asf/amc file works, as well as how to use them. Therefore, simplicity and readability are stressed, while robustness is ignored.

Demo

Demo using PyGame and PyOpenGL:

3D Demo

Demo using Matplotlib:

Static Demo

Usage

There's a simple example in the source code as follows:

if __name__ == '__main__':
  asf_path = './data/01/01.asf'
  amc_path = './data/01/01_01.amc'
  joints = parse_asf(asf_path)
  motions = parse_amc(amc_path)
  frame_idx = 180
  joints['root'].set_motion(motions[frame_idx])
  joints['root'].draw()

And another example in 3Dviewer.py:

  asf_path = './data/01/01.asf'
  amc_path = './data/01/01_01.amc'
  joints = parse_asf(asf_path)
  motions = parse_amc(amc_path)
  v = Viwer(joints, motions)
  v.run()

The data can be found from CMU MoCap dataset.

Parser

The asf/amc parsers are straightforward and easy to understand. The parsers are fully tested on the CMU MoCap dataset, but I don't expect it can work on other datasets without any modification. However, it won't be hard to extend it for more complicating asf/amc files.

Visualization

Matplotlib is used to draw joints and bones in 3D statically; PyGame and PyOpenGL are used to draw motion sequence.

In 3DViewer, we support:

  • WASD to move around.
  • QE to zoom in/out.
  • ↑ ↓ ← → to rotate.
  • LEFT MOUSE BUTTON to drag.
  • RETURN to reset camera view.
  • SPACE to start/pause.
  • , and . to rewind and forward.

NOTE that my implementation of changing view is inefficient (but fluent enough) with some small bugs, but I don't have time to improve it. Pull request is welcomed.

Dependencies

  • numpy
  • transforms3d
  • matplotlib
  • pygame
  • pyopengl

All the dependencies are available via pip install.

One More Thing

If this repo is used in any publications or projects, please let me know. I would be happy and encouraged =)

amcparser's People

Contributors

acbellini avatar calciferzh avatar cheapmeow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

amcparser's Issues

report.

Thank you for opening those code.
But
Small bug is In 3DViewer.py on line 195 and 204.

for j in joints.values():
should be changed to
for j in self.joints.values():

wrong in ',' and '.' pressed

 if pressed[pygame.K_COMMA]:
      self.frame -= 1
      if self.frame >= len(self.motions):
        self.frame = 0
 if pressed[pygame.K_PERIOD]:
      self.frame += 1
      if self.frame < 0:
        self.frame = len(self.motions) - 1

should be

 if pressed[pygame.K_COMMA]:
     self.frame -= 1
     if self.frame < 0:
        self.frame = len(self.motions) - 1
 if pressed[pygame.K_PERIOD]:
      self.frame += 1
      if self.frame >= len(self.motions):
        self.frame = 0

normalizing joint length

First of all, I would like to thank you for this work. I am very impressed, this is extremely helpful and I am planning in using it for my master thesis. In order to do that on the other hand I would need to perform joint normalization, so joints would be the same length in different animations?
Can you provide any idea of how can I change that?

Plot AMC/ASF anc C3D data

Hi! I am tying to plot skeleton and maker data. I know that c3d data are in mm, which is the units of AMC data? When you plot you fix the axis limits, I can't understand the units of the coordinate system.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.