diva.sketch.toolbox
Class DehookingStrokeFilter

java.lang.Object
  extended by diva.sketch.toolbox.StrokeFilter
      extended by diva.sketch.toolbox.DehookingStrokeFilter

public class DehookingStrokeFilter
extends StrokeFilter

Eliminate the serifs at the ends of a stroke. (W.W.Loy and I.D.Landau, "An On-Line Procedure for Recognition of Handprinted Alphanumeric Characters", IEEE transactions on PAMI, Vol. PAMI-4, No.4, July 1982)

Version:
$Revision: 1.7 $
Author:
Heloise Hse (hwawen@eecs.berkeley.edu)

Field Summary
static double DEFAULT_ANGLE_THRESHOLD
           
 
Fields inherited from class diva.sketch.toolbox.StrokeFilter
PROPERTY_KEY
 
Constructor Summary
DehookingStrokeFilter()
          Create a dehooking stroke filter with the default parameters.
 
Method Summary
 TimedStroke apply(TimedStroke s)
          Apply a filtering algorithm on the specified pen stroke and return the filtered stroke.
static TimedStroke dehook(TimedStroke s)
          At the beginning and the end of the given stroke, calculate the general direction vectors by taking the 2/10 of the total length from each end.
static TimedStroke dehook(TimedStroke s, double angleThresh)
           
static TimedStroke dehook2(TimedStroke s)
           
 double getHookAngleThresh()
          Return the threshold angle value for a hook.
 void setHookAngleThresh(double val)
          Set the threshold angle value for testing for a hook.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ANGLE_THRESHOLD

public static final double DEFAULT_ANGLE_THRESHOLD
See Also:
Constant Field Values
Constructor Detail

DehookingStrokeFilter

public DehookingStrokeFilter()
Create a dehooking stroke filter with the default parameters.

Method Detail

apply

public TimedStroke apply(TimedStroke s)
Description copied from class: StrokeFilter
Apply a filtering algorithm on the specified pen stroke and return the filtered stroke.

Specified by:
apply in class StrokeFilter

dehook2

public static TimedStroke dehook2(TimedStroke s)

dehook

public static TimedStroke dehook(TimedStroke s)
At the beginning and the end of the given stroke, calculate the general direction vectors by taking the 2/10 of the total length from each end. Then start from 1/10 of the total length going toward the end of the stroke, compute the angle formed by the local vector and the general vector. If the angle value exceeds the DEFAULT_ANGLE_THRESH, eliminate the remaining points to get rid of the hook.


dehook

public static TimedStroke dehook(TimedStroke s,
                                 double angleThresh)

setHookAngleThresh

public void setHookAngleThresh(double val)
Set the threshold angle value for testing for a hook.


getHookAngleThresh

public double getHookAngleThresh()
Return the threshold angle value for a hook.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.