hmi.sensors.eyebox2.aggregate
Class SingleUserTracker

java.lang.Object
  extended by hmi.sensors.eyebox2.aggregate.SingleUserTracker
All Implemented Interfaces:
XuukListener

public class SingleUserTracker
extends Object
implements XuukListener

This interface exposes a simplified interpretation of the Eyebox data to an application. Using a Listener interface, the application can receive 3 events from this SingleUserTracker: - userAppeared - userDisappeared - userMoved Coordinates are between 0 and 1 - relative to the camera view. (0,0) is left bottom of camera image. Note that this concerns ONE SINGLE FACE, i.e. as far the application is concerned, there is at most one user present. Long term tracking of a single user in the presence of other users is hidden within this SingleUserTracker class. NOTE The application should call checkLostFace regularly! Only calling that method will notify the listener of lost faces... (alternative would have been an active thread in this class -- and I don't like that)

Author:
Dennis Reidsma

Field Summary
private static float camHeight
           
private static float camWidth
          resolution of camera
private  int currentlyActiveFace
          The face that is currently being tracked.
private  boolean debug
           
private  HashMap<Integer,EyePair> eyes
           
private  HashMap<Integer,Face> faces
           
private  JFrame jframe
           
private  boolean lostFace
          true iff we are tracking a face and have just lost it
private  long lostTime
          when did we lose the tracked face?
private  JEditorPane outputEyes
           
private  JEditorPane outputFaces
           
private  String outputTextEyes
           
private  String outputTextFaces
           
private static long RETAINFACETIME
          Number of milisecs that face info is remembered when a face disappears for a short term...
private  boolean showUI
           
private  ArrayList<SingleUserTrackerListener> singleUserTrackerListeners
           
private  long starttime
           
private  XuukReader xuukReader
           
 
Constructor Summary
SingleUserTracker(XuukReader xr)
           
 
Method Summary
 void addListener(SingleUserTrackerListener listener)
           
 void checkLostFace()
          checks whether the currently tracked face, if any, has been lost for such a long time that a message should be sent.
 void eyesChange(EyePair newEyepair)
           
 void eyesDisappeared(int id)
           
 void faceAppeared(Face face)
           
 void faceDisappeared(int id)
           
 void initUI()
           
 void newEyesPositions(ArrayList<EyePair> newEyes)
           
 void newFacePositions(ArrayList<Face> newFaces)
           
 void removeListener(SingleUserTrackerListener listener)
           
 void setText()
          Update the UI, for debugging purposes
 void toggleUI()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RETAINFACETIME

private static final long RETAINFACETIME
Number of milisecs that face info is remembered when a face disappears for a short term...

See Also:
Constant Field Values

starttime

private long starttime

camWidth

private static final float camWidth
resolution of camera

See Also:
Constant Field Values

camHeight

private static final float camHeight
See Also:
Constant Field Values

faces

private HashMap<Integer,Face> faces

eyes

private HashMap<Integer,EyePair> eyes

currentlyActiveFace

private int currentlyActiveFace
The face that is currently being tracked. Even when the face disappears for a few seconds, we need to remember its ID in case the face comes back.


lostFace

private boolean lostFace
true iff we are tracking a face and have just lost it


lostTime

private long lostTime
when did we lose the tracked face?


debug

private boolean debug

xuukReader

private XuukReader xuukReader

singleUserTrackerListeners

private ArrayList<SingleUserTrackerListener> singleUserTrackerListeners

jframe

private JFrame jframe

outputFaces

private JEditorPane outputFaces

outputEyes

private JEditorPane outputEyes

outputTextFaces

private String outputTextFaces

outputTextEyes

private String outputTextEyes

showUI

private boolean showUI
Constructor Detail

SingleUserTracker

public SingleUserTracker(XuukReader xr)
Method Detail

addListener

public void addListener(SingleUserTrackerListener listener)

removeListener

public void removeListener(SingleUserTrackerListener listener)

checkLostFace

public void checkLostFace()
checks whether the currently tracked face, if any, has been lost for such a long time that a message should be sent. To be called every few seconds by the app (!)


faceAppeared

public void faceAppeared(Face face)
Specified by:
faceAppeared in interface XuukListener

faceDisappeared

public void faceDisappeared(int id)
Specified by:
faceDisappeared in interface XuukListener

newFacePositions

public void newFacePositions(ArrayList<Face> newFaces)
Specified by:
newFacePositions in interface XuukListener

eyesChange

public void eyesChange(EyePair newEyepair)
Specified by:
eyesChange in interface XuukListener

eyesDisappeared

public void eyesDisappeared(int id)
Specified by:
eyesDisappeared in interface XuukListener

newEyesPositions

public void newEyesPositions(ArrayList<EyePair> newEyes)
Specified by:
newEyesPositions in interface XuukListener

toggleUI

public void toggleUI()

initUI

public void initUI()

setText

public void setText()
Update the UI, for debugging purposes