Coder Social home page Coder Social logo

maya-mocap's Introduction

Maya Mocap

N.B.: This toolbox is not maintained anymore. You can switch to Pose2Sim_Blender to get access to similar tools (and more).

Maya Mocap is a collection of open-source tools for Motion Capture in Maya.

Tested on Maya 2018 (python 2) and on Maya 2022 (python 3). Not tested on Linux nor MacOS yet.

Contents

  1. How to
  2. Camera toolbox
  3. Imports
    1. OBJ sequence import
    2. Opensim import
    3. TRC import
    4. C3D import
    5. BVH import
    6. FBX import
  4. Others
    1. C3D to TRC
  5. To-do list
  6. Send Us Feedback!
  7. Contributers
  8. Citation
  9. License

How to

  1. First you need to install python packages in Maya. Open a command prompt (Windows -> cmd).
    Type the following (replace <YEAR> with your version):

    "C:\Program Files\Autodesk\Maya<YEAR>\bin\mayapy" -m pip install opencv-python pandas c3d numpy anytree toml
    

  If it does not work, check there.

  1. Clone the repository or just download the python pieces of code you need.

  2. Open file at <PATH_TO_DOCUMENTS_FOLDER>\maya\<YEAR>\maya.env. Create it if it does't exist.
    Type the following (replace what's in capital letters):

    MAYA_SHELF_PATH = <PATH_TO_MAYA_MOCAP>\shelves
    PYTHONPATH = <PATH_TO_MAYA_MOCAP>\scripts 
    MAYA_PLUG_IN_PATH = <PATH_TO_MAYA_MOCAP>\plug-ins
    

    You may also need to add this PYTHONPATH to your environment variables.
    Windows -> Environment Variables -> New -> Name: PYTHONPATH, Value: <PATH_TO_MAYA_MOCAP>\scripts

That's it! After opening Maya, you should get a new shelf with new tools ready to be used.
image

Camera toolbox

maya_camToolbox.py is a toolbox for various operations on cameras in Maya.
Lets you:

  • set cameras in scene from chosen specs.
  • or set cameras from calibration file (.toml).
  • save a calibration file from cameras in scene.
  • film image sequences from the cameras in scene.
  • display image sequences in scene.
  • reproject selected objects on image camera planes.
  • display 3D path of selected objects (due to a bug in Maya 2018, works only for "all frames" in this version).

image image

Imports

OBJ sequence import

maya_objs.py lets you:

  • Displays a sequence of OBJ files in an "objStreamNode" (uses plug-in objStreamNode).
  • These OBJ don't need to be coherent in time (e.g. vertex number, etc).
  • Assign textures to the meshes.

image

Opensim import

...Coming soon...
maya_osim.py lets you:

  • Import an .osim model.
  • Animate it with .mot inverse kinematics.

TRC import

maya_trc.py lets you:

  • Import trc files.
  • Choose if you only want to display the markers, or also to construct the skeleton.
  • In case you want the skeleton (and it's not Openpose body_25b), please refer to the section SKELETON DEFINITION.

image

C3D import

maya_c3d.py lets you:

  • First convert c3d to trc files using c3d2trc.py.
  • Then import resulting trc files.
  • Choose if you only want to display the markers, or also to construct the skeleton.
  • In case you want the skeleton (and it's not Openpose body_25b), please refer to SKELETON DEFINITION in trc import.
  • ⚠️ Beware that it only allows you to retrieve 3D points, you won't get analog data with this code.

BVH import

Jeroen Hoolmans wrote an awesome free BVH (BioVision Hierarchy) importer.
It is slightly adapted here to be made compatibly with python 3 (Maya 2022 and above).

FBX import

Instructions for importing FBX files can be found at this address.

Others

C3D to TRC

c3d2trc.py lets you:

  • Convert c3d binary files to trc format.
  • Usage: Open a command line in your cloned repository.
    Type python c3d2trc -i '<your_c3d_file> or python c3d2trc.py -i <your_c3d_file> -o <your_trc_file>.
  • ⚠️ Beware that it only allows you to retrieve 3D points, you won't get analog data with this code.**

To-do list

This repository is meant to get more tools in the future. Please feel free to add your suggestions and/or code! Among others, I'd like to add:

  • An Xsens importer.
  • An Opensim importer (.osim model, and .mot inverse kinematics).

Send Us Feedback!

This library is open source for research purposes, and I want to improve it! So let me know (create a new GitHub issue or pull request, email us, etc.) if you:

  1. Find/fix any bug or know how to improve anything.
  2. Want to add/show some cool functionality/demo/project regarding motion capture in Maya. We would love to integrate your project to this repository!

Contributers

David Pagnon (maintainer), [email protected]
Lionel Reveret, [email protected]

Citation

If you find our work useful in your research, please cite it.

License

The code found on this repository is free to use, edit, and redistribute under the BSD-3 licensing terms.

maya-mocap's People

Contributors

davidpagnon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mineclever

maya-mocap's Issues

Skeleton generation fails during c3d import with Full body Plug-in Gait VICON marker set

Hi everyone,

I'm currently struggling to convert motion capture data from c3d format (Nexus VICON) to trc format to generate a skeleton for animation purposes.

Indeed, the skeleton generation fails during c3d import of a recordign using a Full body Plug-in Gait VICON marker set.
When I tried a direct c3d import from the shelf with all skeletons (MPI not available from Maya GUI) I have the error message :
“maya_trc.py line 194: name 'skeleton_box' is not defined”

Furthermore, I've noticed that a trc file has been generated anyway. However, once I try to import it from the trc shelf, whatever the skeleton I use, I have the error message:
“Error: KeyError: file C:...\base.py line 3812: 'RHip_Z' (with BODY_25, BODY_25B, COCO, MPI) or CHipJ7 (with BODY_135) or CHipJ8 (with custom)

I don't what I'm missing or doing wrong... Can anyone help me with this conundrum ?

Thank you in advance for your help !

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.