diva.sketch.recognition
Class VotingStrokeRecognizer

java.lang.Object
  extended by diva.sketch.recognition.VotingStrokeRecognizer
All Implemented Interfaces:
StrokeRecognizer

public class VotingStrokeRecognizer
extends Object
implements StrokeRecognizer

Voting gesture recognizer is a composite recognizer which allows multiple sub-recognizers to vote and interact with one another to classify a given gesture.

For each gesture, the voting recognizer can produce one or more classifications. The algorithm works as follows:

  1. There is an incoming stroke event.
  2. The recognizer directs this event to all of its sub- recognizers, which may or may not produce recognitions.
  3. The recognitions that are produced are buffered internally, and when all recognizers finish, the recognitions are combined using a voting policy described below. The resulting recognition set is returned.
This class also contains a number of heuristics for preserving only the N-highest recognitions, filtering out recognitions with low-confidence values, etc.

Version:
$Revision: 1.7 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Field Summary
static int ALL_VOTES
          A constant which says that votes are not filtered by the "n-highest" rule.
 
Constructor Summary
VotingStrokeRecognizer(StrokeRecognizer[] children)
          Construct a voting recognizer with the following children recognizers.
 
Method Summary
 List children()
          Return the children as a list.
 void clearBuffer()
          Clear the buffer after every stroke finishes by setting every entry in the buffer to NO_RECOGNITION.
 double getMinConfidence()
          Return the minimum confidence value which is necessary for a type to get considered in the vote.
 int getNHighest()
          Return the "n-highest" value, which says that the n-highest classifications will get passed on when the child recognizers vote.
 void setMinConfidence(double val)
          Set the minimum confidence classifications that will get passed on when the child recognizers vote.
 void setNHighest(int n)
          Set the "n-highest" value, which says that the n-highest classifications will get passed on when the child recognizers vote.
 RecognitionSet strokeCompleted(TimedStroke s)
          Pass the event to the child recognizers, tally the vote, clear the buffer, and return the consensus.
 RecognitionSet strokeModified(TimedStroke s)
          Pass the event to the child recognizers, tally the vote, and return the consensus.
 RecognitionSet strokeStarted(TimedStroke s)
          Pass the event to the child recognizers, tally the vote, and return the consensus.
protected  RecognitionSet vote()
          Tally all of the votes of the sub-recognizers and emit them all into a recognition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_VOTES

public static int ALL_VOTES
A constant which says that votes are not filtered by the "n-highest" rule.

See Also:
setNHighest(int)
Constructor Detail

VotingStrokeRecognizer

public VotingStrokeRecognizer(StrokeRecognizer[] children)
Construct a voting recognizer with the following children recognizers.

Method Detail

children

public List children()
Return the children as a list.


clearBuffer

public void clearBuffer()
Clear the buffer after every stroke finishes by setting every entry in the buffer to NO_RECOGNITION.


getMinConfidence

public double getMinConfidence()
Return the minimum confidence value which is necessary for a type to get considered in the vote.


getNHighest

public int getNHighest()
Return the "n-highest" value, which says that the n-highest classifications will get passed on when the child recognizers vote.


setMinConfidence

public void setMinConfidence(double val)
Set the minimum confidence classifications that will get passed on when the child recognizers vote. The default value is 0, meaning that classifications are not filtered.


setNHighest

public void setNHighest(int n)
Set the "n-highest" value, which says that the n-highest classifications will get passed on when the child recognizers vote. The default value is ALL_VOTES, which means that all votes are passed on. The value N must be greater than or equal to zero.


strokeCompleted

public RecognitionSet strokeCompleted(TimedStroke s)
Pass the event to the child recognizers, tally the vote, clear the buffer, and return the consensus.

Specified by:
strokeCompleted in interface StrokeRecognizer

strokeModified

public RecognitionSet strokeModified(TimedStroke s)
Pass the event to the child recognizers, tally the vote, and return the consensus.

Specified by:
strokeModified in interface StrokeRecognizer

strokeStarted

public RecognitionSet strokeStarted(TimedStroke s)
Pass the event to the child recognizers, tally the vote, and return the consensus.

Specified by:
strokeStarted in interface StrokeRecognizer

vote

protected RecognitionSet vote()
Tally all of the votes of the sub-recognizers and emit them all into a recognition. Subclasses can override this method to change the voting behavior/strategy. Return NO_RECOGNITION if the vote comes up empty. This method implements the N-highest and min-confidence heuristics, described in the getNHighest() and getMinConfidence() method descriptions.

See Also:
getNHighest(), getMinConfidence()


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