public class RubineClassifier extends AbstractClassifier
Modifier and Type | Field and Description |
---|---|
static double |
DIST_SQ_THRESHOLD |
static java.lang.String[] |
NAME_FEATURES |
static int |
PF_ATH
index of sum of absolute values of angles traversed) in a vector of features.
|
static int |
PF_BB_LEN
index of length of bounding box diagonal in a vector of features.
|
static int |
PF_BB_TH
index of angle of bounding box diagonal in a vector of features.
|
static int |
PF_DUR
index of path duration in a vector of features.
|
static int |
PF_INIT_COS
index of cosinus initial angle (angle between first and third points) in a vector of features.
|
static int |
PF_INIT_SIN
index of sinus initial angle (angle between first and third points) in a vector of features.
|
static int |
PF_LEN
index of arc length of path in a vector of features.
|
static int |
PF_MAXV
index of maximum speed in a vector of features.
|
static int |
PF_SE_COS
index of cosinus of angle between start and end points in a vector of features.
|
static int |
PF_SE_LEN
index of length between start and end points in a vector of features.
|
static int |
PF_SE_SIN
index of sinus of angle between start and end points in a vector of features.
|
static int |
PF_SQTH
index of sum of squares of angles traversed) in a vector of features.
|
static int |
PF_TH
index of total angle traversed in a vector of features.
|
static double |
SE_TH_ROLLOFF |
Constructor and Description |
---|
RubineClassifier() |
Modifier and Type | Method and Description |
---|---|
int |
addClass(java.lang.String className)
Adds a class of gestures to this classifier.
|
void |
addExample(java.lang.String className,
Gesture example)
Adds a gesture example to this classifier.
|
java.lang.String |
classify(Gesture g)
Recognizes a gesture.
|
double |
distance(java.lang.String gesture1,
java.lang.String gesture2) |
double |
getCurrentDistance() |
java.util.Vector<Gesture> |
getExamples(java.lang.String className)
Returns the vector of gesture examples for a given class.
|
static java.util.Vector<java.lang.Double> |
getFeatures(Gesture g)
Computes the vector of features for a gesture.
|
java.util.Vector<java.lang.Double> |
getFeatures(java.lang.String className)
Computes the vector of features for a given class of gestures.
|
static java.util.Vector<java.lang.Double> |
getFeatures(java.util.Vector<java.awt.geom.Point2D> points)
Computes the vector of features for a list of points.
|
int |
getMaximumDistance() |
int |
getNbGestureExamples(java.lang.String className) |
CPolyLine |
getRepresentative(java.lang.String className)
Returns a graphical representation for a given class of gestures.
|
java.util.Vector<java.lang.Double> |
getWeights(java.lang.String className) |
static RubineClassifier |
newClassifier(java.io.File filename)
Builds a new classifier by loading its definition in a file.
|
static RubineClassifier |
newClassifier(java.lang.String file)
Builds a new classifier by loading its definition in a file.
|
static RubineClassifier |
newClassifier(java.net.URL url)
Builds a new classifier by loading its definition in a url.
|
void |
removeClass(java.lang.String className)
Removes a class of gestures from this classifier.
|
void |
removeExample(Gesture example)
Removes a gesture example from this classifier.
|
void |
renameClass(java.lang.String previousClassName,
java.lang.String newClassName)
Renames a class of gestures.
|
void |
reset()
Resets this classifier (i.e.
|
void |
setMaximumDistance(int dist)
Sets a maximum distance threshold for recognition.
|
java.util.Vector<Score> |
sortedClasses(Gesture g)
Computes a sorted list of classes contained in this recognizer from the
best match to the the worst match given a gesture.
|
addClassifierListener, fireClassAdded, fireClassRemoved, fireExampleAdded, fireExampleRemoved, fireTemplateSet, getClassesNames, getMinimumStrokeLength, getPngImage, getPngImage, getTemplate, getTemplates, removeClassifierListener, save, setMinimumStrokeLength, setTemplate
public static double DIST_SQ_THRESHOLD
public static double SE_TH_ROLLOFF
public static int PF_INIT_COS
public static int PF_INIT_SIN
public static int PF_BB_LEN
public static int PF_BB_TH
public static int PF_SE_LEN
public static int PF_SE_COS
public static int PF_SE_SIN
public static int PF_LEN
public static int PF_TH
public static int PF_ATH
public static int PF_SQTH
public static int PF_DUR
public static final int PF_MAXV
public static java.lang.String[] NAME_FEATURES
public static RubineClassifier newClassifier(java.lang.String file)
file
- The name of the file containing the definition of the
classifier.public static RubineClassifier newClassifier(java.net.URL url)
url
- The url containing the definition of the classifier.public static RubineClassifier newClassifier(java.io.File filename)
filename
- The name of the file containing the definition of the
classifier.public void reset()
reset
in class AbstractClassifier
public void removeClass(java.lang.String className)
removeClass
in class AbstractClassifier
className
- The name of the class of gestures to remove.public CPolyLine getRepresentative(java.lang.String className)
getRepresentative
in class AbstractClassifier
className
- the name of the gesture class.className
.public java.lang.String classify(Gesture g) throws java.lang.Exception
classify
in class AbstractClassifier
g
- The gesture to recognizejava.lang.Exception
public int addClass(java.lang.String className)
addClass
in class AbstractClassifier
className
- The name of the class of gestures to add.public java.util.Vector<java.lang.Double> getWeights(java.lang.String className)
public java.util.Vector<java.lang.Double> getFeatures(java.lang.String className)
className
- The name of the class of gesture.className
class of
gestures, null if this class does not exist.public int getNbGestureExamples(java.lang.String className)
className
- The name of the class of gesture.className
class of
gestures, -1 if this class does not exist..public double getCurrentDistance()
public void setMaximumDistance(int dist)
classify
returns null). By default, this distance is set
to 1000.dist
- The maximum distance to the average vector of recognized
class.public int getMaximumDistance()
public java.util.Vector<Score> sortedClasses(Gesture g)
sortedClasses
in class AbstractClassifier
g
- The gesturepublic static java.util.Vector<java.lang.Double> getFeatures(Gesture g)
g
- The gesturepublic static java.util.Vector<java.lang.Double> getFeatures(java.util.Vector<java.awt.geom.Point2D> points)
points
- The list of pointspublic void removeExample(Gesture example)
removeExample
in class AbstractClassifier
example
- the gesture to removepublic void addExample(java.lang.String className, Gesture example)
addExample
in class AbstractClassifier
className
- the gesture example's classexample
- the gesture examplepublic void renameClass(java.lang.String previousClassName, java.lang.String newClassName)
renameClass
in class AbstractClassifier
previousClassName
- The current name of this class of gesturesnewClassName
- The new name of this class of gesturespublic java.util.Vector<Gesture> getExamples(java.lang.String className) throws java.lang.UnsupportedOperationException
getExamples
in class AbstractClassifier
className
- The name of the classclassName
.java.lang.UnsupportedOperationException
public double distance(java.lang.String gesture1, java.lang.String gesture2)
distance
in class AbstractClassifier