|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfrog.Session
public class Session
Session is the FROG representation of a single user. A session keeps track of all the objects and methods that must be run in a certain order on data passed to it from a device.
| Constructor Summary | |
|---|---|
Session()
Creates a new Session. |
|
| Method Summary | |
|---|---|
void |
accelerationPerformed(AccelEvent e)
Run every time a single acceleration has come in. |
void |
addFilter(Filter filter)
Adds a filter to this session. |
void |
addFilter(Filter filter,
int index)
Adds a filter in a particular order to this session. |
void |
addSessionListener(SessionListener sl)
Adds a new SessionListener to this Session. |
void |
dispose()
Completely destroys this session. |
void |
editGesture(int index)
Sets the current gesture to the one specified by the index. |
void |
gestureComplete(boolean good,
Device d)
Run when a single gesture has been completed. |
Filter[] |
getActiveFilters()
Returns a list of filters currently active on this Session. |
int |
getCurrentGestureIndex()
Accessor for the current gesture index. |
Device |
getDevice()
Returns the Device this Session is receiving acceleration data from. |
BufferedImage |
getGestureIcon(int index)
Returns the icon of the gesture specified by the index. |
String |
getGestureName(int index)
Returns the name of the gesture specified by the index. |
Vector<GestureModel> |
getGestureSession()
Returns the gesture session stored by this Session object. |
double |
getLastProbability()
Accessor for the last recognition event probability. |
String |
getName()
Returns the name of this Session. |
void |
inRecognitionMode()
Sets the mode to recognition, enabling/disabling certain functionality. |
void |
inTrainingMode()
Sets the mode to training, enabling/disabling certain functionality. |
GestureModel |
newGesture(String name)
Creates a new gesture and adds it to the current session. |
GestureModel |
newGesture(String name,
byte[] imgBuf)
Creates a new gesture with a given image and adds it to the current session. |
void |
notifyGestureRecognized(GestureModel g)
Notifies all SessionListeners of a recognition of a gesture g |
boolean |
removeAccel(int inum,
int anum)
Deletes an individual acceleration from the current gesture in the current gesture session at the specified index (assuming the indices are valid). |
boolean |
removeAccel(int snum,
int inum,
int anum)
Deletes an individual acceleration from the current gesture session at the specified index (assuming the indices are valid). |
void |
removeFilter(int i)
Removes a filter at a given index. |
boolean |
removeInstance(int inum)
Deletes a gesture instance from the current gesture in the current gesture session at the specified index (assuming the index is valid). |
boolean |
removeInstance(int snum,
int inum)
Deletes a gesture instance from current gesture session at the specified index (assuming the index is valid). |
void |
removeSessionListener(SessionListener sl)
Removes a SessionListener from this Session's list of listeners |
boolean |
removeSet()
Deletes a gesture set from the current gesture session. |
boolean |
removeSet(int snum)
Deletes a gesture set from the current gesture session at the specified index (assuming the index is valid). |
void |
restoreDefaults()
Restores the default training parameters for this session. |
void |
setClassifierType(int type)
Sets the type (an integer - see Classifier)
of classifier to be used in the Session. |
void |
setDevice(Device d)
Sets the device for this Session. |
void |
setGestureIcon(byte[] imageBuffer)
Sets the icon of the current gesture to the one contained in a byte array. |
boolean |
setGestureIcon(int index,
byte[] imageBuffer)
Sets the icon of the specified gesture to the one contained in a byte array. |
boolean |
setGestureModelType(int type)
Sets the type (an integer - see GestureModel)
of gesture model to be used in the Session. |
void |
setName(String name)
Sets the name of this Session. |
String |
toString()
|
boolean |
train()
Trains the GestureModel representing the current gesture in the current gesture session. |
boolean |
train(int index)
Trains the GestureModel at the given index in the current gesture session. |
boolean |
train(int index,
GestureHMMParameters gParams)
Trains the GestureHMM at the given index in the current gesture session with the specified parameters. |
boolean |
train(int index,
GestureHMMParameters gParams,
KmeansParameters kParams)
Trains the GestureHMM at the given index in the current gesture session with the specified parameters. |
void |
trainAll()
Trains every GestureModel in the current gesture session. |
void |
unexpectedDisconnect(Device d)
For handling an unexpected disconnect from a device. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Session()
| Method Detail |
|---|
public void accelerationPerformed(AccelEvent e)
DeviceListener
accelerationPerformed in interface DeviceListenere - contains the acceleration data and the calling devicepublic void addFilter(Filter filter)
filter - the filter to be added
public void addFilter(Filter filter,
int index)
filter - the filter to be addedindex - the position in the filter order
ArrayOutOfBoundsException - if the position was invalidpublic void addSessionListener(SessionListener sl)
sl - a new SessionListener to be notified of Session changespublic void dispose()
public void editGesture(int index)
index - the index of the gesture to work on
public void gestureComplete(boolean good,
Device d)
DeviceListener
gestureComplete in interface DeviceListenergood - true if this gesture is complete.
false if this gesture should be discarded.d - the device that completed the gesturepublic Filter[] getActiveFilters()
public int getCurrentGestureIndex()
public Device getDevice()
public BufferedImage getGestureIcon(int index)
null if the GestureModel has no icon or if the
index was invalid.
index - the index of the gesture to retrieve the icon of
null if:
public String getGestureName(int index)
index - the index of the gesture to retrieve the name of
null if the index
was invalidpublic Vector<GestureModel> getGestureSession()
public double getLastProbability()
public String getName()
public void inRecognitionMode()
public void inTrainingMode()
public GestureModel newGesture(String name)
name - the name to give this gesture; cannot be null
IllegalArgumentExecption - if the gesture name is null
public GestureModel newGesture(String name,
byte[] imgBuf)
throws IOException
name - the name to give this gesture; cannot be nullimgBuf - the byte array of the image to use as an icon
IOException - if there was a problem creating an icon from the
given byte arraypublic void notifyGestureRecognized(GestureModel g)
g - the gesture g (a GestureModel) that was recognized
public boolean removeAccel(int inum,
int anum)
inum - the index of the gesture instanceanum - the index of the Accel3D to delete
public boolean removeAccel(int snum,
int inum,
int anum)
snum - the index of the gesture setinum - the index of the gesture instanceanum - the index of the Accel3D to delete
public void removeFilter(int i)
i - the index for deletionpublic boolean removeInstance(int inum)
inum - the index of the instance to delete
public boolean removeInstance(int snum,
int inum)
snum - the index of the gesture setinum - the index of the instance to delete
public void removeSessionListener(SessionListener sl)
sl - The SessionListener to removepublic boolean removeSet()
public boolean removeSet(int snum)
snum - the index of the gesture set to delete
public void restoreDefaults()
public void setClassifierType(int type)
Classifier)
of classifier to be used in the Session.
type - the classifier type
public void setDevice(Device d)
throws IOException
d - The device to connect to
IOException
public void setGestureIcon(byte[] imageBuffer)
throws IOException
imageBuffer - the byte array containing the data to construct an
image for the icon
IOException - if an image could not be constructed from the given
byte array
public boolean setGestureIcon(int index,
byte[] imageBuffer)
throws IOException
index - the index of the gesture to modifyimageBuffer - the byte array containing the data to construct an
image for the icon
true if the index was valid;
false otherwise.
IOException - if an image could not be constructed from the given
byte arraypublic boolean setGestureModelType(int type)
GestureModel)
of gesture model to be used in the Session. This will modify
which gesture session is currently in use. That is, Session
can work on multiple different types of GestureModel sessions,
but must focus on a single one at a time.
type - the gesture model type
public boolean train()
setGestureModelType(int).
Requires being in training mode.
public boolean train(int index)
setGestureModelType(int).
Requires being in training mode.
index - the index of the GestureModel to train
public boolean train(int index,
GestureHMMParameters gParams)
index - the index of the GestureHMM to traingParams - the parameters for the GestureHMM
public boolean train(int index,
GestureHMMParameters gParams,
KmeansParameters kParams)
index - gParams -
public void trainAll()
public void setName(String name)
name - the name to give this Sessionpublic String toString()
toString in class Objectpublic void unexpectedDisconnect(Device d)
DeviceListener
unexpectedDisconnect in interface DeviceListenerd - Device that was unexpectedly disconnected
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||