© 2006-2007 ETH Zurich

org.ximtec.igesture
Class Recogniser

java.lang.Object
  extended by org.ximtec.igesture.Recogniser

public class Recogniser
extends Object

The main recogniser component.

Version:
1.0, Dec 2006
Author:
Ueli Kurmann, igesture@uelikurmann.ch, Beat Signer, signer@inf.ethz.ch

Field Summary
static int MIXED_MODE
           
static int MULTIMODAL_MODE
           
static int NORMAL_MODE
           
 
Constructor Summary
Recogniser(Configuration config)
          Creates a new recogniser.
Recogniser(Configuration config, GestureHandler gestureHandler)
          Creates a new recogniser.
Recogniser(Configuration config, GestureSet gestureSet)
          Creates a new recogniser.
Recogniser(InputStream config)
          Creates a new recogniser.
Recogniser(InputStream config, InputStream set, GestureHandler gestureHandler)
          Creates a new recogniser.
 
Method Summary
 void addGestureHandler(GestureHandler gestureHandler)
          Adds a gesture handler to the recogniser.
 void addMultimodalGestureHandler(GestureHandler handler)
          Add a multimodal gesture handler to the recogniser.
protected  void fireEvent(ResultSet resultSet)
          Fires an event and informs all registered gesture handlers.
 List<Algorithm> getAlgorithms()
           
 Set<GestureHandler> getGestureHandlers()
          Get the associated gesture handlers.
 int getMode()
          Get the mode of this recogniser
static Recogniser newRecogniser(String configFile, String gestureSetFile)
           
 ResultSet recognise(Gesture<?> gesture)
          Recognises a gesture.
 ResultSet recognise(Gesture<?> gesture, boolean recogniseAll)
          Recognises a gesture.
 ResultSet recognise(org.sigtec.ink.Note note)
          Recognises a gesture.
 ResultSet recognise(org.sigtec.ink.Note note, boolean recogniseAll)
          Recognises a gesture.
 void removeGestureHandler(GestureHandler gestureHandler)
          Removes a gesture handler from the recogniser.
 void removeMultimodalGestureHandler(GestureHandler handler)
          Remove a multimodal gesture handler from the recogniser
 void setMode(int mode)
          Change the mode of this recogniser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIXED_MODE

public static final int MIXED_MODE
See Also:
Constant Field Values

MULTIMODAL_MODE

public static final int MULTIMODAL_MODE
See Also:
Constant Field Values

NORMAL_MODE

public static final int NORMAL_MODE
See Also:
Constant Field Values
Constructor Detail

Recogniser

public Recogniser(Configuration config)
           throws AlgorithmException
Creates a new recogniser.

Parameters:
config - the configuration object.
Throws:
AlgorithmException - if the recogniser could not be created.

Recogniser

public Recogniser(Configuration config,
                  GestureHandler gestureHandler)
           throws AlgorithmException
Creates a new recogniser.

Parameters:
config - the configuration object.
gestureHandler - the gesture handler to be added.
Throws:
AlgorithmException - if the recogniser could not be created.

Recogniser

public Recogniser(Configuration config,
                  GestureSet gestureSet)
           throws AlgorithmException
Creates a new recogniser.

Parameters:
config - the configuration object.
gestureSet - the gesture set to be used.
Throws:
AlgorithmException - if the recogniser could not be created.

Recogniser

public Recogniser(InputStream config)
           throws AlgorithmException
Creates a new recogniser.

Parameters:
config - the input stream from which the XML configuration can be read.
Throws:
AlgorithmException - if the recogniser could not be created.

Recogniser

public Recogniser(InputStream config,
                  InputStream set,
                  GestureHandler gestureHandler)
           throws AlgorithmException
Creates a new recogniser.

Parameters:
config - the input stream from where the XML configuration can be read.
set - the input stream from where the gesture set in XML format can be read.
gestureHandler - the gesture handler to be informed about results.
Throws:
AlgorithmException - if the recogniser could not be created.
Method Detail

addGestureHandler

public void addGestureHandler(GestureHandler gestureHandler)
Adds a gesture handler to the recogniser. The gesture handler's handle() method will be invoked every time a new ResultSet has been created (as part of a recognition process).

Parameters:
gestureHandler - the gesture handler to be added.

removeGestureHandler

public void removeGestureHandler(GestureHandler gestureHandler)
Removes a gesture handler from the recogniser.

Parameters:
gestureHandler - the gesture handler to be removed.

fireEvent

protected void fireEvent(ResultSet resultSet)
Fires an event and informs all registered gesture handlers.

Parameters:
resultSet - the result set to be used as an argument for the fired event.

recognise

public ResultSet recognise(Gesture<?> gesture,
                           boolean recogniseAll)
Recognises a gesture. The method uses all algorithms and returns a combination of the results returned by the different algorithms if 'recogniseAll' is set to true or the result of the first algorithm that recognised the given gesture if 'recogniseAll' is set to false.

Parameters:
gesture - the gesture to be recognised.
recogniseAll - true if the combination of all algorithms has to be returned, false if only the result of the first algorithm that recognises the result has to be returned.
Returns:
the result set containing the recognised gesture classes.

recognise

public ResultSet recognise(Gesture<?> gesture)
Recognises a gesture. The method uses all registered algorithms and stops as soon as the first algorithm returns a result.

Parameters:
gesture - the gesture to be recognised.
Returns:
the result set containing the recognised gesture classes.

recognise

public ResultSet recognise(org.sigtec.ink.Note note)
Recognises a gesture. The method uses all registered algorithms and stops as soon as the first algorithm returns a result.

Parameters:
note - the note to be recognised.
Returns:
the result set containing the recognised gesture classes.

recognise

public ResultSet recognise(org.sigtec.ink.Note note,
                           boolean recogniseAll)
Recognises a gesture. The method uses all algorithms and returns a combination of the results returned by the different algorithms if 'recogniseAll' is set to true or the result of the first algorithm that recognised the given note if 'recogniseAll' is set to false.

Parameters:
note - the note to be recognised.
recogniseAll - true if the combination of all algorithms has to be returned, false if only the result of the first algorithm that recognises the result has to be returned.
Returns:
the result set containing the recognised gesture classes.

getAlgorithms

public List<Algorithm> getAlgorithms()

newRecogniser

public static Recogniser newRecogniser(String configFile,
                                       String gestureSetFile)
                                throws AlgorithmException
Throws:
AlgorithmException

getGestureHandlers

public Set<GestureHandler> getGestureHandlers()
Get the associated gesture handlers.


setMode

public void setMode(int mode)
Change the mode of this recogniser. If the recogniser is in multimodal mode, the gestures are first sent to the multimodal gesture manager that further handles the notification of interested listeners. If the recogniser is in normal mode, the gestures are fired immediately to the interested listeners. If the recogniser is in mixed mode, both behaviors are used.

Parameters:
mode - The value to set

getMode

public int getMode()
Get the mode of this recogniser

Returns:
the mode

addMultimodalGestureHandler

public void addMultimodalGestureHandler(GestureHandler handler)
Add a multimodal gesture handler to the recogniser.


removeMultimodalGestureHandler

public void removeMultimodalGestureHandler(GestureHandler handler)
Remove a multimodal gesture handler from the recogniser


© 2006-2007 ETH Zurich

Copyright © 2007-2010 Global Information Systems Group, ETH Zurich. All Rights Reserved.