hhreco.fragmentation
Class Fragmenter

java.lang.Object
  extended byhhreco.fragmentation.Fragmenter

public class Fragmenter
extends java.lang.Object

Implementation of the fragmentation algorithms that fragment a symbol based on templates specification. The algorithms use a dynamic programming approach.


Constructor Summary
Fragmenter()
           
 
Method Summary
protected static EllipseBasis ellipseFit(double[] xvals, double[] yvals, int num)
          Fit an ellipse to the set of points.
static FitData fragmentWithTemplate(TimedStroke[] strokes, int numE, int numL)
          Fragment the given sequence of strokes with the number of ellipses and the number of lines specified by numE and numL.
static FitData fragmentWithTemplate(TimedStroke[] strokes, java.lang.String template)
          Fragment the given sequence of strokes with the specified template, an ordered sequence of E's and L's.
protected static LineBasis lineFit(double[] xvals, double[] yvals, int num)
          Use total regression to fit the best line to the given set of points.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Fragmenter

public Fragmenter()
Method Detail

fragmentWithTemplate

public static FitData fragmentWithTemplate(TimedStroke[] strokes,
                                           int numE,
                                           int numL)
Fragment the given sequence of strokes with the number of ellipses and the number of lines specified by numE and numL.


fragmentWithTemplate

public static FitData fragmentWithTemplate(TimedStroke[] strokes,
                                           java.lang.String template)
Fragment the given sequence of strokes with the specified template, an ordered sequence of E's and L's.


ellipseFit

protected static EllipseBasis ellipseFit(double[] xvals,
                                         double[] yvals,
                                         int num)
Fit an ellipse to the set of points. To do an elliptical fit, minimum of 6 data points is required to solve for the parameters of the elliptical equation: aX^2+bY^2+cXY+dX+eY+f=0; If the number of points is less than 6, return null. If the parameters of the ellipse are all 0's, return null as well, this is the result of an unsuccessful fit. Otherwise, return an EllipseBasis object with valid parameters.


lineFit

protected static LineBasis lineFit(double[] xvals,
                                   double[] yvals,
                                   int num)
Use total regression to fit the best line to the given set of points.