Motion Capture assignment CPSC 526.
Motion Capture re-sequence framework
Reference Pose
Here is an image of the reference pose with the labeling of all the joints. In order to obtain this pose I just edited one BVH file motion section to 0 on all channels to obtain it.
![]() |
|
![]() |
![]() |
Joint with largest range of movement
The Joint in the sneak1.bvh default file that presents a wider range of movement in its Euler angles is the RigthFoot. To obtain this answer I first calculated the maximum and minimum values for every angle across all the 994 frames of the file in the 72 channels (without taking into consideration the first three ones which represent the X, Y and Z positions of the root Joint and not an angle).
After obtaining the maximum and minimum I calculated the difference between those two numbers and added up for each joint the 3 channels (Z angle, X angle and Y angle rotations respectively) to obtain the total range of movement for each joint. The RightFoot Joint presented a total range movement of 382.9962. If we take into consideration only the range from a single angle and not the sum of the three differences then we get that the RightFoot Joint is also the one that has a broader range and it’s in the Z rotation channel with 193.0236.

To calculate all this data I found it easier to just export the motion part of the bvh file to Excel and calculate from there instead of modifying the process data method in the motion capture framework. The Excel file can be downloaded here.
Motion Capture Resequence
To achieve the motion capture resequence functionality for the framework I came up with the following solution:
First I created a parsing method that will take as a parameter a resequence file and grab the beginning and end times for each sequence that must be played. The format of the sequence file must be as in the following example:
SequenceNum: 2
play 4.5
stop 9.9
play 20.0
stop 30.1
Where the SequenceNum is the number of sequences the file contains, and each sequence is specified by the beginning and end times specified in the lines play and stop respectively. The parsing method is shown in the following image. The data gathered is stored private arrays playData and stopData.

After that the play method needs to call the drawFrame method in the correct order according to the timing specified by the resequence file. To obtain from the time the exact frame numbers that must be played we simply need to know the number of frames and frame time (or sampling rate) which are already specified in the BVH file. To calculate the exact initial and final frame number from the start and end timing we just apply the following formula:
frameNum = time * (1/sampling rate)
The frame rate (1/sampling rate) is usually 30 frames per second, but we want to calculate it anyway just in case. The frame number is stored temporarily at the beginning of sequence execution on the tempFrame1 for the start frame and tempFrame2 for the final segment frame. Finally after calling in the right order the drawFrame method for a sequence we store in some variables the previous facing dDirection and end frame number so that we have a reference of where the next sequence should be positioned and facing at. The play code is shown in the following image:

Finally we want to get the new facing direction and X and Z positions for the sequences that get played after another one. To achieve this since we already have the previous sequence facing direction (lastFaceDir) and the previous end frame number (LastFrameNum) we just need to get the difference between the previous data and the new one and sum it up to the new positions and angles. The difference must be calculated only at the end of each sequence cycle, but applied to every frame. This is calculated as following:
Y rotation difference = Previous frame Y rotation – Current frame Y rotation
rotate Y ( current frame Y rotation + Y rotation difference)
The full draw method is shown in the following image:

The resulting animation and a comparison with the original video are shown next:
| Resequenced Sneak1.bvh animation Z point of view |
Original Sneak1.bvh animation Z point of view |
| Resequenced Sneak1.bvh animation Y point of view |
Original Sneak1.bvh animation Y point of view |
| Resequenced Sneak1.bvh animation X point of view |
Original Sneak1.bvh animation X point of view |
These are some alternative motion capture resequences:
| Hopping ReSequence Animation |
Slow Walk ReSequence Animation |
|
|
Click here to download the zip with all the files
Solution Limitations
Due to time constraints I wasn't able to finish in time the blending for the smoother transition between clips. I also intended to add some code to restrict the user from specifying invalid play or stop time for the clip (as in some time longer than the clip) but I didn't finish this on time either.
Comments: Sergio Juarez. sergejg@yahoo.com


