|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.sketch.toolbox.StrokeFilter
diva.sketch.toolbox.ApproximateStrokeFilter
public class ApproximateStrokeFilter
An object which filters a pen stroke using "approximation by line segments" technique, (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, we can throw away all the in-between points, because they are almost colinear. |
Fields inherited from class diva.sketch.toolbox.StrokeFilter |
---|
PROPERTY_KEY |
Constructor Summary | |
---|---|
ApproximateStrokeFilter()
Construct a ApproximateStrokeFilter with default threshold distance of 2 units. |
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)
Reduce the number of points in the given pen stroke using the "approximation by line segments" algorithm. |
void |
setThreshDistance(int 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()
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)
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 (threshDist). Then, break the line segment into 2 and recursively apply filtering on the 2 parts, (first, P) and (P, last).
public void setThreshDistance(int val)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |