Python
|
Introduction
Motion capture (MoCap) files contain XYZ coordinate data that can be used for
a variety of purposes in computer graphics. The Motion Capture Lab of the
Advanced Computing Center for the Arts and Design, Ohio State University, have
kindly made available a large number of mocap data files in a range of
formats. Field Time C7:X C7:Y C7:Z CLAV:X CLAV:Y CLAV:Z LANK:X LANK:Y LANK:Z 1 0.0000 -62.944 31.271 1378.1 128.62 27.814 1332.7 9.2447 306.52 98.154 2 0.0083 -62.944 31.271 1378.1 129.1 27.252 1333.2 9.1643 306.44 98.074 3 0.0167 -62.944 31.271 1378.1 129.34 27.091 1333.6 9.1643 306.36 97.993 The first line of text lists the names (identifiers) of the mocap markers. Each marker is specified three times, once for each of ite x, y and z values. For example, CLAV:X CLAV:Y CLAV:Z If there are 40 markers there will be 120 xyz coordinates listed on each line of a TXT file. The tags named 'Field' and 'Time' are not the names of markers and, therefore, for the purpose of reading a mocap data file their values can be ignored. There might be several thousands of lines of coordinates in a mocap file. The process of reading and storing mocap data is as follows.
|
The MoCap Classes
Listing 1 provides the code for the mocap classes. The class named |
Using the MoCapDB Class
1. Download one of the TXT files from the Motion Capture Lab. from mocap_db import MoCapDB scene_scale = 0.01 db = MoCapDB('PATH_TO_MOCAP_DATA_FILE', scene_scale) markerID = 2 start = 1 end = 10 step = 1 coords = db.getMarkerData(markerID, start, end, step) print coords
Execute the python script and you will see a list of xyz values for the third
marker (index 2) from frame 1 to frame 10 in 1 frame steps.
|
© 2002- Malcolm Kesson. All rights reserved.