|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthhreco.toolbox.StrokeFilter
hhreco.toolbox.ApproximateStrokeFilter
Implementation of a point reduction technique.
[1] Hanaki, Temma, Yoshida, "An On-line Character Recognition Aimed at a Substitution for a Billing Machine Keyboard", Pattern Recognition, Vol.8, pp63-71, 1976.
Field Summary | |
static double |
DEFAULT_THRESH_DISTANCE
If the farthest point from a line segment is less than the DEFAULT_THRESH_DISTANCE, remove all of the in-between points. |
Constructor Summary | |
ApproximateStrokeFilter()
Construct a ApproximateStrokeFilter with default threshold distance of 4 units. |
|
ApproximateStrokeFilter(double threshold)
Construct a ApproximateStrokeFilter with the given threshold. |
Method Summary | |
TimedStroke |
apply(TimedStroke s)
Reduce the number of points in the given pen stroke using the "approximation by line segments" algorithm. |
static TimedStroke |
approximate(TimedStroke s)
Reduce the number of points in the given pen stroke using the "approximation by line segments" algorithm. |
static TimedStroke |
approximate(TimedStroke s,
double threshDist)
Approximate the given stroke using the specified threshold distance. |
double |
getThreshDistance()
Return the threshold distance. |
void |
setThreshDistance(double val)
Set the threshold distance of a point from a line segment. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final double DEFAULT_THRESH_DISTANCE
Constructor Detail |
public ApproximateStrokeFilter()
public ApproximateStrokeFilter(double threshold)
Method Detail |
public TimedStroke apply(TimedStroke s)
Algorithm: Form a line with the first and last points of the stroke. Find a farthest point (P) from the line segment such that distance between the line and P exceeds a threshold value. Then, break the line segment into 2 and recursively apply filtering on the 2 parts, (first, P) and (P, last). The threshold value is defaulted to DEFAULT_THRESH_DISTANCE.
apply
in class StrokeFilter
s
- the stroke to be filtered.public static TimedStroke approximate(TimedStroke s)
Algorithm: Form a line with the first and last points of the stroke. Find a farthest point (P) from the line segment such that distance between the line and P exceeds a threshold value. Then, break the line segment into 2 and recursively apply filtering on the 2 parts, (first, P) and (P, last). The threshold value is defaulted to DEFAULT_THRESH_DISTANCE.
s
- the stroke to be filtered.public static TimedStroke approximate(TimedStroke s, double threshDist)
public void setThreshDistance(double val)
public double getThreshDistance()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |