Assignment 3: Displaying Motion Capture Data

This project required us to create a viewer for motion capture data. The viewer was meant to be fully functional and allow a certain degree of motion editing through interpolation.

The program was implemented for IRIX with OpenGL being used to display the graphics. The interface is a simple key based interface.


Part 1: Reading motion data

The program can read the BioVision .bvh format. The hierarchy is read in full generality so that .bvh files which do not correspond to humans should be able to be read. One assumption that was mad was that each limb would have either 3 or 6 channels of information, and each set of three would represent either an Euler rotation or a translation. While the rotations can be specified in any order, they are always applied in Z-X-Y order.

Part 2: Displaying the data

OpenGL was used for displaying the data. The graphics are not especially colorful, but they do indicate different data. Several different sets of lines appear in the display and each is colored accordingly.

The error vectors are drawn to indicate how far an interpolated motion is from the original motion. The vector is drawn from the end of each End Site of the interpolated skeleton to the End Site of the original skelton.

The keyboard interface allows the user to stop and start the animation, step through the animation frame by frame, toggle euler/quaternion angle representations, set start/stop frame for interpolation, and toggle the display of motion traces. The user can also play the animatio in reverse. The speed of the animation is set according to the input files Frame rate parameter.

Part 3: Computing the forward kinematics

Forward kinematics are used to display the skeleton, the motion traces, and the shadow. At the beginning of each frame the kinematics are calculated recurivly through a tree structure which represents the skeleton hierarchy. The locations of the beginning and end of each limb are stored in the tree. Once the forward kinematics are computed and stored, the drawing routines use the information to draw the appropriate lines. Note: the forward kinematics are computed every frame

The motion of the End Sites was stored in a list and drawn according to the motion trace toggle. These lists are cleared when the motion wraps around to the beginning of the motion, or when the motion is reversed.

Part 4: Convert to Quaternions

The user can specify whether interpolations occur between Euler angles or quaternions. The conversions are done on the fly and both representations are finally converted to a rotation matrix to facilitate computations.

Part 5: Interpolating motion

The user can manually set start and stop frames for interpolating the angles of motion. By switching between Euler and quaternion representations, the two interpolation methods can be compared directly. In general, it was difficult to see striking differences between the two unless the start and stop frames were far apart. It was also difficult to label one interpolation as more natural than the other.

Part 6: Automatic keyframe genration

The user can also choose to create a keyframe representation of the motion. The default number of keyframes is 20, and the user can adjust this as necessary. The two animations below illustrate the results with the motion from TIP06.BVH. The original sequence of 141 frames was reduced to a set of 20 keyframes through which the motion was interpolated using euler angles. Note that the keyframes appear as quick flashes of bright green, while the error shows up as magenta lines.

Original Motion
Keyframed Motion

The algorithm is essentially a greedy algorithm. The set of keyframes is initialized to all the frames of animation. At each iteration the error associated with removing each frame is calculated. Then the frame with the smallest error is removed, and the animation though that frame is interpolated. The algorithm works with both Euler angle interpolation and quaternion interpolation.

The error metric used was the sum of the squared Euclidean distance from the interpolated End Sites to the original End Sites.

The figure above illustrates the accumulated error as a function of interpolated frames. The error clearly increases as the number of interpolated frames increases. However, the error for the quaternion interpolation increases at a slower, more even, rate. The accumulated error for Euler anlge interpolation experiences more sudden jumps and grows at a greater rate.

Part 7: Source Code

The source code for the assignment can be found here. You can also find an IRIX executable here as well as a couple of sample .bvh files. Note: I have picked up a strange (and inneficient) coding styly since I started programming in Java; I tend to write my entire class specification in header files - Oh well. I also used several outside resources to complete this assignment.

Part 8: User Interface

For those who have access to IRIX and wish to download the executable here is the primitive user interface: