rubine
Class Classifier

java.lang.Object
  extended byrubine.Classifier
All Implemented Interfaces:
java.io.Serializable

public class Classifier
extends java.lang.Object
implements java.io.Serializable

A classifier that implements rubine's algorithm to classify gestures.

Author:
Caroline Appert
See Also:
Serialized Form

Constructor Summary
Classifier()
           
 
Method Summary
 void addClass(GestureClass d)
          Adds a class of gestures to this classifier.
 GestureClass classify(Gesture g)
          Recognizes a gesture.
 void compile()
          Compiles this classifier (i.e. performs training).
 GestureClass createClass(java.lang.String name)
          Creates a new class of gestures.
 GestureClass findClass(java.lang.String name)
          Looks for the class of gestures labeled by a given name.
static Classifier load(java.lang.String filename)
          Builds a new classifier by loading its definition in a file.
static Classifier newClassifier(java.lang.String file)
          Builds a gesture classifier.
 Gesture newGesture()
          Builds a new gesture to classify with this classifier.
 void removeClass(GestureClass d)
          Removes a class of gestures from this classifier.
 void reset()
          Resets this classifier (i.e. removes all the classes of gestures).
 void save(java.lang.String filename)
          Saves the definition of this classifier in a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Classifier

public Classifier()
Method Detail

newClassifier

public static Classifier newClassifier(java.lang.String file)
Builds a gesture classifier.

Parameters:
file - The name of the file containing the definition of the classifier.
Returns:
The newly created classifier.

newGesture

public Gesture newGesture()
Builds a new gesture to classify with this classifier.

Returns:
Returns the newly created gesture.

createClass

public GestureClass createClass(java.lang.String name)
Creates a new class of gestures.

Parameters:
name - The name of the new class of gestures.
Returns:
Returns the newly created class.

load

public static Classifier load(java.lang.String filename)
Builds a new classifier by loading its definition in a file.

Parameters:
filename - The name of the file containing the definition of the classifier.
Returns:
The newly created classifier.

save

public void save(java.lang.String filename)
Saves the definition of this classifier in a file.

Parameters:
filename - The name of the file where to write the definition of the classifier.

reset

public void reset()
Resets this classifier (i.e. removes all the classes of gestures).


addClass

public void addClass(GestureClass d)
Adds a class of gestures to this classifier.

Parameters:
d - The class of gestures to add.

removeClass

public void removeClass(GestureClass d)
Removes a class of gestures from this classifier.

Parameters:
d - The class of gestures to remove.

findClass

public GestureClass findClass(java.lang.String name)
Looks for the class of gestures labeled by a given name.

Parameters:
name - The name of the class to look for.
Returns:
Returns the class of gestures labeled by name if it exists, null if it does not exist.

compile

public void compile()
Compiles this classifier (i.e. performs training).


classify

public GestureClass classify(Gesture g)
                      throws ClassifierNotTrainedException
Recognizes a gesture.

Parameters:
g - The gesture to recognize
Returns:
Returns The class of gestures that best fit to g.
Throws:
ClassifierNotTrainedException - If the classifier is not trained (compute must have been called)