|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.sketch.features.CornerFE
public class CornerFE
CornerFE computes the number of corners in a stroke by enumerating over the data points in the stroke. For every three points, it computes the angle formed by two vectors. If the dot product of the two neighboring vectors is less than 0.6 (empirical value), a cusp is detected. Then the magnitudes of the two vectors are calculated. If both of the vector magnitudes divided by the total path length are less than a threshold value (20%), then this is not really a corner. Otherwise it is likely to be a corner.
Field Summary | |
---|---|
static double |
DEFAULT_THRESH_DOT
The default dot product value for determining whether two vectors form a corner. |
static double |
DEFAULT_THRESH_MAG_RATIO
The default threshold ratio of a segment length to the entire path length of the stroke. |
static double |
DEFAULT_THRESH_RELAXED_DOT
If the dot product of two vectors is greater than DEFAULT_THRESH_DOT but less than this parameter (DEFAULT_THRESH_RELAXED_DOT), we identify this to be a likely corner, and more checkings are performed on the two vectors to verify. |
static String |
PROPERTY_KEY
The key to access the cached corner property. |
Constructor Summary | |
---|---|
CornerFE()
Create a CornerFE with default parameters. |
|
CornerFE(double magThresh,
double dotThresh,
double dotRelaxThresh)
Create a CornerFE with the specified parameters. |
Method Summary | |
---|---|
double |
apply(TimedStroke s)
Return the number of corners in the specified stroke. |
static int[] |
cornerIndices(TimedStroke s)
Return the indices where the corners occur in the given stroke. |
static int[] |
cornerIndices(TimedStroke s,
double threshMagRatio,
double threshDot,
double threshRelaxedDot)
Return the indices where the corners occur in the given stroke. |
String |
getName()
Return the name of this feature extractor. |
static int |
numCorners(TimedStroke s)
Return the number of corners in the given stroke. |
static int |
numCorners(TimedStroke s,
double threshMagRatio,
double threshDot,
double threshRelaxedDot)
Return the number of corners in the given stroke. |
void |
setDotThreshold(double val)
Set the dot product threshold for determining whether two vectors form a corner. |
void |
setMagRatioThreshold(double val)
Set the magnitude ratio threshold. |
void |
setRelaxedDotThreshold(double val)
If the dot product of two vectors is greater than _threshDot but less than this parameter (_threshRelaxedDot), we identify this to be a likely corner, and more checkings are performed on the two vectors to verify. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROPERTY_KEY
public static final double DEFAULT_THRESH_MAG_RATIO
public static final double DEFAULT_THRESH_DOT
public static final double DEFAULT_THRESH_RELAXED_DOT
Constructor Detail |
---|
public CornerFE()
public CornerFE(double magThresh, double dotThresh, double dotRelaxThresh)
Method Detail |
---|
public double apply(TimedStroke s)
First check to see if this feature already exists in the stroke's property table (access using PROPERTY_KEY). If so, return that value (cast to double). Otherwise call numCorners to compute and cache the result in the table.
apply
in interface FeatureExtractor
public static final int[] cornerIndices(TimedStroke s)
public static final int[] cornerIndices(TimedStroke s, double threshMagRatio, double threshDot, double threshRelaxedDot)
public String getName()
getName
in interface FeatureExtractor
public static final int numCorners(TimedStroke s)
public static final int numCorners(TimedStroke s, double threshMagRatio, double threshDot, double threshRelaxedDot)
public void setDotThreshold(double val)
public void setMagRatioThreshold(double val)
public void setRelaxedDotThreshold(double val)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |