Blog for work on my Masters thesis - a survey of methods for evaluating media understanding, object detection, and pattern matching algorithms. Mostly, it is related to ViPER, the Video Performance Evaluation Resource. If you find a good reference, or would like to comment, e-mail viper at cfar.umd.edu.
Archives
Media Processing Evaluation Weblog
Wednesday, December 22, 2004
Adding the Omega Shape for 'Head and Shoulders' Tracking
I've been working on updating the Hacker's Guide to ViPER, and its corresponding cousin, so it is appropriate that I do this in the context of actually extending ViPER. I've hit a brick wall with making ViPER. As usual, I discover a whole host of issues with the extension. The first thing I did was try to make it so that a user could add a data type without modifying the existing source code. Then I went about implementing it.
First, I modified a the canvas manager to use the configuration n3 file, instead of using a hard coded switch statement, to select the java classes to load when a spatial data type is found. I also had to make a similar change to the Interpolator. Finally, I added support for arbitrary method invocation; before, the AppLoader n4 format only supported property getting/setting and some simple event handling. The added properties are:
- gt:visualNode
- in the form [datatype] this "class", this associates a PNode, Attributable java class with a spatial data type, which will then be used for display.
- gt:visualCreator
- This associates a 'creator' event handler with a given spatial data type. The creator event handler is used when the value of the current attribute is empty.
- gt:visualEditor
- This associates an 'editor' event handler with a given spatial data type.
- gt:interpolator
- Associates the data type with an interpolator bean.
- lal:invoke
- When a loaded bean is initialized, this method will be invoked.
- lal:methodName
- The name of the method to be invoked during initialization.
- lal:parameters
- A list of parameters to pass to the method. Since java is strongly typed, this might require some trial and error. I think right now it falls back to Strings if it can't determine the data type.
After modifying the .n3 file to use these new properties, and testing to make sure the system still worked, I started working on the omega shape. Since the omega shape is for heads, I decided it should be defined with respect to the center, unlike the oriented box, which is defined by one of the corners. This will make the rotation about the center a little less jerky than it is on the oriented box. The shape is basically a circle with a line beneath it. The line represents the orientation of the omega. Later, it may become useful to define additional parameters, such as allowing the loop to be an arbitrary ellipsoid, or allowing it to slide along the baseline, but this is the shape we will define for now: A center point, an orientation, a diameter, and the length of the line.
In order to add any shape to the viper-gt interface, it needs three parts: an object that will be used internally (this can be an existing class, even a String), an 'AttributeWrapper' for the ViPER API to use for data typing, input, and output, and a JTable cell editor, so that the user can modify the value in the spreadsheet view. I put all of this code into a single package in my eclipse workspace, and have attached all the java code as a single archive. For reference, here are the modifications to my gt-config.n3 file:
###### # Add 'omega' example shape ###### :datatypes lal:invoke [ lal:methodName "addType" ; lal:parameters ( "http://lamp.cfar.umd.edu/viperdata#" "omega" "edu.umd.cfar.lamp.viper.examples.omegahead.AttributeWrapperOmega" ) ] . data:omega gt:visualNode "edu.umd.cfar.lamp.viper.examples.omegahead.OmegaNode" ; gt:visualCreator "edu.umd.cfar.lamp.viper.examples.omegahead.OmegaCanvasCreator" ; gt:visualEditor "edu.umd.cfar.lamp.viper.examples.omegahead.OmegaCanvasEditor" ; gt:interpolator [ a lal:TemporaryBean ; lal:className "edu.umd.cfar.lamp.viper.examples.omegahead.OmegaInterpolator" ] ; props:editor [ a lal:TemporaryBean , props:Editor ; lal:className "edu.umd.cfar.lamp.viper.examples.omegahead.OmegaCellEditor" ; lal:setProperty :setMediatorToMediator ; lal:setProperty :setNodeToParent ] .
The first line invokes the method addTypes
on the dataTypes
bean. This allows the data type to be selected in the schema editor, and serialized and loaded from saved files. The code for the referenced class, AttributeWrapperOmega
, is included in the attached zip archive below. This class is implements AttrValueParser, which provides the (de)serialization methods, and AttributeValueWrapper, or, more specifically, DefaultedAttrValueWrapper, which provides type checking and a 'metadefault' attribute value to be used when some non-null value is needed (this is usually some 'zero' value. For Omega head, we use a shape with all zero parameters.) To implement the type checking, it extends InstanceOfConstraint, which makes sure that the object is an instance of a given Java class, in this case 'OmegaHeadModel'.
[TODO: Add stuff about other lines; go into more detail on above]
omegaModelSrc.zip