edu.mit.sketch.toolkit
Class Classifier

java.lang.Object
  |
  +--edu.mit.sketch.toolkit.Classifier
Direct Known Subclasses:
SimpleClassifier

public abstract class Classifier
extends Object

This is the interface for a basic recognition toolkit. The Classifier will deal with single stroke input only. There is a Classifier object associated with each stroke. In conjunction with this class is the StrokeData class. The users must creare a StrokeData object and pass it to this class.


Field Summary
static int COMPLEX
          Constant for COMPLEX
static int ELLIPSE
          Constant for ELLIPSE
protected  ErrorCalculator error_calculator
          The error calculator
static int LINE
          Constant for line
static int POLYGON
          Constant for POLYGON
protected  StrokeData stroke_data
          The stroke data
 
Constructor Summary
Classifier()
           
 
Method Summary
abstract  int classify()
          Returns the best fit type for the strokeData
abstract  int[] classify(double error_bound)
          Returns the set of types that fit the stroke with error value less than the bound specified.
abstract  GeneralPath getComplexApproximation()
          Returns the best fit Polygon for the StrokeData.
abstract  double getComplexError()
          Returns the error between the best fit GeneralPath and the strokeData.
abstract  Ellipse getEllipseApproximation()
          Returns the best fit Polygon for the StrokeData.
abstract  double getEllipseError()
          Returns the error between the best fit ellipse and the strokeData.
abstract  Line getLineApproximation()
          Returns the best fit Polygon for the StrokeData.
abstract  double getLineError()
          Returns the error between the best fit line and the strokeData.
abstract  Polygon getPolygonApproximation()
          Returns the best fit Polygon for the StrokeData.
abstract  double getPolygonError()
          Returns the error between the best fit polygon and the strokeData.
abstract  boolean isComplex()
          Returns true if the best fit for the strokeData is a complex shape.
abstract  boolean isComplex(double error_bound)
          Returns true if the best fit complex shape has error measure less than error_bound.
abstract  boolean isEllipse()
          Returns true if the best fit for the strokeData is an Ellipse.
abstract  boolean isEllipse(double error_bound)
          Returns true if the best fit ellipse for the strokeData is less than error_bound.
abstract  boolean isLine()
          Returns true if the best fit shape for the strokeData is a Line.
abstract  boolean isLine(double error_bound)
          Returns true if the best fit line has an error of less than error_bound.
abstract  boolean isPolygon()
          Returns true if the best fit for strokeData is a polygon.
abstract  boolean isPolygon(double error_bound)
          Returns true if the best fit polygon has an error of less than bound.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLYGON

public static final int POLYGON
Constant for POLYGON

ELLIPSE

public static final int ELLIPSE
Constant for ELLIPSE

COMPLEX

public static final int COMPLEX
Constant for COMPLEX

LINE

public static final int LINE
Constant for line

stroke_data

protected StrokeData stroke_data
The stroke data

error_calculator

protected ErrorCalculator error_calculator
The error calculator
Constructor Detail

Classifier

public Classifier()
Method Detail

classify

public abstract int classify()
Returns the best fit type for the strokeData

classify

public abstract int[] classify(double error_bound)
Returns the set of types that fit the stroke with error value less than the bound specified.

isPolygon

public abstract boolean isPolygon()
Returns true if the best fit for strokeData is a polygon.

isPolygon

public abstract boolean isPolygon(double error_bound)
Returns true if the best fit polygon has an error of less than bound. The error is calculated with the m_ErrorCalculator class, which by default uses squared error (unless another error calculator was passed in when the classifier was created.

isEllipse

public abstract boolean isEllipse()
Returns true if the best fit for the strokeData is an Ellipse.

isEllipse

public abstract boolean isEllipse(double error_bound)
Returns true if the best fit ellipse for the strokeData is less than error_bound.

isComplex

public abstract boolean isComplex()
Returns true if the best fit for the strokeData is a complex shape.

isComplex

public abstract boolean isComplex(double error_bound)
Returns true if the best fit complex shape has error measure less than error_bound.

isLine

public abstract boolean isLine()
Returns true if the best fit shape for the strokeData is a Line.

isLine

public abstract boolean isLine(double error_bound)
Returns true if the best fit line has an error of less than error_bound.

getPolygonError

public abstract double getPolygonError()
Returns the error between the best fit polygon and the strokeData. The error is calculated according to the ErrorCalculator, which uses squared error if not set by the user.

getEllipseError

public abstract double getEllipseError()
Returns the error between the best fit ellipse and the strokeData. The error is calculated according to the ErrorCalculator, which uses squared error if not set by the user.

getComplexError

public abstract double getComplexError()
Returns the error between the best fit GeneralPath and the strokeData. The error is calculated according to the ErrorCalculator, which uses squared error if not set by the user.

getLineError

public abstract double getLineError()
Returns the error between the best fit line and the strokeData. The error is calculated according to the ErrorCalculator, which uses squared error if not set by the user.

getPolygonApproximation

public abstract Polygon getPolygonApproximation()
Returns the best fit Polygon for the StrokeData. I have used the class OurPolygon here because we will be using a standard library of shapes which may or may not be the same as the Java defined shapes. (That has yet to be determined.)

getEllipseApproximation

public abstract Ellipse getEllipseApproximation()
Returns the best fit Polygon for the StrokeData. I have used the class OurPolygon here because we will be using a standard library of shapes which may or may not be the same as the Java defined shapes. (That has yet to be determined.)

getComplexApproximation

public abstract GeneralPath getComplexApproximation()
Returns the best fit Polygon for the StrokeData. I have used the class OurPolygon here because we will be using a standard library of shapes which may or may not be the same as the Java defined shapes. (That has yet to be determined.)

getLineApproximation

public abstract Line getLineApproximation()
Returns the best fit Polygon for the StrokeData. I have used the class OurPolygon here because we will be using a standard library of shapes which may or may not be the same as the Java defined shapes. (That has yet to be determined.)