Friday, 8 April 2011

Post 8 - Adding Metrics

TL:DR - Pictures towards the bottom

For the analysis of the animation, we're going to require a lot more information than just the bounding boxes we currently use. To this end, a few new metrics to analyse have now been added to the project.

First thing to mention though is the increased efficiency. The bounding-box search for each frame was improved by using information from the previous frame, which brought the time down for analysing each frame from ~550ms to the 350-400ms range. However after adding the new metrics, the average time now hovers around the 500ms mark. Never mind, did I mention we have more metrics to measure?!


X-Centroid
The first measure is the x-centroid. After the background has been subtracted, we take each scanline through the image and find the average x-coordinate of the remaining pixels. The average of these averages then provides our x-centroid, which roughly corresponds to the center of the person.


X-Eccentricity
The second measure is the x-eccentricity. This is simply the x-distance between the actual centre of the bounding-box and the x-centroid. This gives a nice measure of how far off to one side the person is. For example, if the person punches/kicks, this will change.


X-Velocity
The third and (currently) final measure is the x-velocity. This is the distance from the x-centroid in the previous frame to the x-centroid in the current frame. So if the person moves from left to right between two frames, we will see a positive x-velocity of some value.

Pictures!
Enough words! Pictures explain it better anyway. (Click to enlarge!)
Red Box: Bounding Box
Vertical Red Line: Half Bounding Box
Vertical Green Line: X-Centroid
Space between vertical red/green: X-Eccentricity
Horizontal Green Line: X-Velociy


Standing Still

Moving Left -> Right

Moving Right-> Left

Crouching


















































Crouching Punch

















Why do we not calculate these for y-coordinates? Well, simply put we're taking a short cut in the fact that vertical movement doesn't happen very much, we're much more interested in x-movement for the time being. They may be added at a later time though.

Next up:
  • Centralising images for the game.
  • Complicated data mining.
  • SOUND! If anyone knows a good java library for sound, let me know! I'm currently investigating jOrbis and paulscode, but other possibilities would be greatly appreciated!
Edit:
Nearly forgot, a system for playing animations in the game has now been added too! Bonus!

2 comments:

  1. What would you use x-eccentricity for?

    I would like to see a post about the aims of this project.

    ReplyDelete
  2. You can think of x-eccentricity as showing whether the centroid is left or right of the centre of the box, as a +/- sign. Admittedly it is very similar to the x-centroid, so it's probably better to think of the centroid as a half-way step to eccentricity. The centroid itself will probably be more useful for positioning the centralised image for the animation, while (I hope) the eccentricity will be more helpful for the animation creation.

    I'll post about the aims soon! :)

    ReplyDelete