jAER project on SourceForge

ch.unizh.ini.jaer.projects.pawtracker
Class PawTracker

java.lang.Object
  extended by net.sf.jaer.eventprocessing.EventFilter
      extended by net.sf.jaer.eventprocessing.EventFilter2D
          extended by ch.unizh.ini.jaer.projects.pawtracker.PawTracker
All Implemented Interfaces:
java.util.Observer, FrameAnnotater

public class PawTracker
extends EventFilter2D
implements FrameAnnotater, java.util.Observer

Tracks Rat's Paw (too fill)

A single cluster tracks each object but the cluster simultaneously maintains several hypotheses about the size of the object. A cluster is moved by the presently-dominant hypothesis. The present hypothesis is highlighted in annotation. The dominant hypothesis for object size is the one that has most support per pixel. A small object with large hypothesis has low average support but a large object with small hypotesis will have more support from the large hypothesis (usually).

Author:
tobi

Nested Class Summary
 class PawTracker.Cluster
          Represents a single tracked object
 class PawTracker.EntryZone
          Represents a single tracked object
 
Field Summary
static float ASPECT_RATIO_MAX
          maximum and minimum allowed dynamic aspect ratio
static float ASPECT_RATIO_MIN
          maximum and minimum allowed dynamic aspect ratio
protected  AEChip chip
           
protected  int clusterCounter
           
protected  float defaultClusterRadius
           
protected static float fullbrightnessLifetime
           
protected  boolean growMergedSizeEnabled
           
protected  float mixingFactor
           
protected  boolean pawIsDetected
           
protected  java.util.LinkedList<PawTracker.Cluster> pruneList
           
protected  java.util.Random random
           
protected  float velocityMixingFactor
           
 
Fields inherited from class net.sf.jaer.eventprocessing.EventFilter2D
enclosedFilter, out
 
Fields inherited from class net.sf.jaer.eventprocessing.EventFilter
annotationEnabled, enclosedFilterChain, filterEnabled, log, perf, propertyTooltipMap, support
 
Constructor Summary
PawTracker(AEChip chip)
          Creates a new instance of PawTracker
 
Method Summary
 void annotate(float[][][] frame)
          annotate the rendered retina frame to show locations of clusters
 void annotate(javax.media.opengl.GLAutoDrawable drawable)
          Each annotator enters annotate with graphics context current, in coordinates with pixel 0,0 in LL corner (note opposite from Java2D) and pixel spacing 1 unit after the scaling transform (which is already active).
 void annotate(java.awt.Graphics2D g)
          each annotator is called by the relevant class (e.g.
protected  void drawBox(javax.media.opengl.GL gl, int x, int y, int sx, int sy)
           
 EventPacket filterPacket(EventPacket in)
          Subclasses implement this method to define custom processing.
 float getAspectRatio()
           
 float getChange_ratio()
           
 float getClassifierThreshold()
           
 int getClusterLifetimeWithoutSupportUs()
          lifetime of cluster in ms without support
 java.util.List<PawTracker.Cluster> getClusters()
           
 float getClusterSize()
          max distance from cluster to event as fraction of size of array
 boolean getDynamicSizeEnabled()
           
 int getEntry_xa()
           
 int getEntry_xb()
           
 int getEntry_ya()
           
 int getEntry_yb()
           
 int getEntryZone_pixel_threshold()
           
 int getEntryZone_threshold()
           
 java.lang.Object getFilterState()
          should return the filter state in some useful form
 int getMax_fingers()
           
 int getMaxNumClusters()
          max number of clusters
 int getMin_events_per_cluster()
           
 float getMixingFactor()
           
 int getNumClusters()
           
 int getPaw_tip_size()
           
 int getPellet_size()
           
 int getPredictiveVelocityFactor()
           
 float getSurround()
           
 int getThresholdEventsForVisibleCluster()
          number of events to make a potential cluster visible
 float getThresholdISIForVisibleCluster()
          number of events to make a potential cluster visible
 float getVelocityMixingFactor()
           
 int getWrist_xa()
           
 int getWrist_xb()
           
 int getWrist_ya()
           
 int getWrist_yb()
           
 void initFilter()
          this should allocate and initialize memory: it may be called when the chip e.g.
 boolean isClassifierEnabled()
           
 boolean isColorClustersDifferentlyEnabled()
           
 boolean isDynamicAspectRatioEnabled()
           
 boolean isGrowMergedSizeEnabled()
           
 boolean isHighwayPerspectiveEnabled()
           
 boolean isLogDataEnabled()
           
 boolean isPathsEnabled()
           
 boolean isResetPawTracking()
           
 boolean isShowAllClusters()
           
 boolean isShowClusters()
           
 boolean isShowFingers()
           
 boolean isShowVelocity()
           
 boolean isUseOffPolarityOnlyEnabled()
           
 boolean isUseOnePolarityOnlyEnabled()
           
 void resetFilter()
          should reset the filter to initial state
 void setAspectRatio(float aspectRatio)
           
 void setChange_ratio(float change_ratio)
           
 void setClassifierEnabled(boolean classifierEnabled)
          Sets whether classifier is enabled.
 void setClassifierThreshold(float classifierThreshold)
           
 void setClusterLifetimeWithoutSupportUs(int clusterLifetimeWithoutSupport)
          lifetime of cluster in ms without support
 void setClusterSize(float clusterSize)
          sets max distance from cluster center to event as fraction of maximum size of chip pixel array.
 void setColorClustersDifferentlyEnabled(boolean colorClustersDifferentlyEnabled)
           
 void setDynamicAspectRatioEnabled(boolean dynamicAspectRatioEnabled)
           
 void setDynamicSizeEnabled(boolean dynamicSizeEnabled)
          Enables cluster size scaling.
 void setEntry_xa(int entry_xa)
           
 void setEntry_xb(int entry_xb)
           
 void setEntry_ya(int entry_ya)
           
 void setEntry_yb(int entry_yb)
           
 void setEntryZone_pixel_threshold(int entryZone_pixel_threshold)
           
 void setEntryZone_threshold(int entryZone_threshold)
           
 void setGrowMergedSizeEnabled(boolean growMergedSizeEnabled)
           
 void setHighwayPerspectiveEnabled(boolean highwayPerspectiveEnabled)
           
 void setLogDataEnabled(boolean logDataEnabled)
           
 void setMax_fingers(int max_fingers)
           
 void setMaxNumClusters(int maxNumClusters)
          max number of clusters
 void setMin_events_per_cluster(int min_events_per_cluster)
           
 void setMixingFactor(float mixingFactor)
           
 void setPathsEnabled(boolean pathsEnabled)
           
 void setPaw_tip_size(int paw_tip_size)
           
 void setPellet_size(int pellet_size)
           
 void setPredictiveVelocityFactor(int predictiveVelocityFactor)
           
 void setResetPawTracking(boolean resetPawTracking)
           
 void setShowAllClusters(boolean showAllClusters)
          Sets annotation visibility of clusters that are not "visible"
 void setShowClusters(boolean showClusters)
           
 void setShowFingers(boolean showFingers)
           
 void setShowVelocity(boolean showVelocity)
           
 void setSurround(float surround)
          sets scale factor of radius that events outside the cluster size can affect the size of the cluster if scaling is enabled.
 void setThresholdEventsForVisibleCluster(int thresholdEventsForVisibleCluster)
          number of events to make a potential cluster visible
 void setThresholdISIForVisibleCluster(float thresholdISIForVisibleCluster)
          number of events to make a potential cluster visible
 void setUseOffPolarityOnlyEnabled(boolean useOffPolarityOnlyEnabled)
           
 void setUseOnePolarityOnlyEnabled(boolean useOnePolarityOnlyEnabled)
           
 void setVelocityMixingFactor(float velocityMixingFactor)
           
 void setWrist_xa(int wrist_xa)
           
 void setWrist_xb(int wrist_xb)
           
 void setWrist_ya(int wrist_ya)
           
 void setWrist_yb(int wrist_yb)
           
 java.lang.String toString()
           
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class net.sf.jaer.eventprocessing.EventFilter2D
checkOutputPacketEventType, checkOutputPacketEventType, getEnclosedFilter, resetOut, setEnclosedFilter, setFilterEnabled
 
Methods inherited from class net.sf.jaer.eventprocessing.EventFilter
getChip, getDescription, getEnclosedFilterChain, getEnclosingFilter, getPrefs, getPropertyChangeSupport, getPropertyTooltip, isAnnotationEnabled, isEnclosed, isFilterEnabled, prefsEnabledKey, setAnnotationEnabled, setChip, setEnclosed, setEnclosedFilter, setEnclosedFilterChain, setEnclosingFilter, setPreferredEnabledState, setPrefs, setPropertyTooltip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.jaer.graphics.FrameAnnotater
isAnnotationEnabled, setAnnotationEnabled
 

Field Detail

chip

protected AEChip chip

defaultClusterRadius

protected float defaultClusterRadius

mixingFactor

protected float mixingFactor

velocityMixingFactor

protected float velocityMixingFactor

growMergedSizeEnabled

protected boolean growMergedSizeEnabled

ASPECT_RATIO_MAX

public static final float ASPECT_RATIO_MAX
maximum and minimum allowed dynamic aspect ratio

See Also:
Constant Field Values

ASPECT_RATIO_MIN

public static final float ASPECT_RATIO_MIN
maximum and minimum allowed dynamic aspect ratio

See Also:
Constant Field Values

pawIsDetected

protected boolean pawIsDetected

pruneList

protected java.util.LinkedList<PawTracker.Cluster> pruneList

clusterCounter

protected int clusterCounter

fullbrightnessLifetime

protected static final float fullbrightnessLifetime
See Also:
Constant Field Values

random

protected java.util.Random random
Constructor Detail

PawTracker

public PawTracker(AEChip chip)
Creates a new instance of PawTracker

Method Detail

initFilter

public void initFilter()
Description copied from class: EventFilter
this should allocate and initialize memory: it may be called when the chip e.g. size parameters are changed after creation of the filter

Specified by:
initFilter in class EventFilter

getNumClusters

public int getNumClusters()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getClusters

public java.util.List<PawTracker.Cluster> getClusters()

getClusterLifetimeWithoutSupportUs

public final int getClusterLifetimeWithoutSupportUs()
lifetime of cluster in ms without support


setClusterLifetimeWithoutSupportUs

public void setClusterLifetimeWithoutSupportUs(int clusterLifetimeWithoutSupport)
lifetime of cluster in ms without support


getClusterSize

public final float getClusterSize()
max distance from cluster to event as fraction of size of array


setClusterSize

public void setClusterSize(float clusterSize)
sets max distance from cluster center to event as fraction of maximum size of chip pixel array. e.g. clusterSize=0.5 and 128x64 array means cluster has radius of 0.5*128=64 pixels.

Parameters:
clusterSize -

getMaxNumClusters

public final int getMaxNumClusters()
max number of clusters


setMaxNumClusters

public void setMaxNumClusters(int maxNumClusters)
max number of clusters


getThresholdEventsForVisibleCluster

public final int getThresholdEventsForVisibleCluster()
number of events to make a potential cluster visible


setThresholdEventsForVisibleCluster

public void setThresholdEventsForVisibleCluster(int thresholdEventsForVisibleCluster)
number of events to make a potential cluster visible


getThresholdISIForVisibleCluster

public final float getThresholdISIForVisibleCluster()
number of events to make a potential cluster visible


setThresholdISIForVisibleCluster

public void setThresholdISIForVisibleCluster(float thresholdISIForVisibleCluster)
number of events to make a potential cluster visible


getFilterState

public java.lang.Object getFilterState()
Description copied from class: EventFilter
should return the filter state in some useful form

Specified by:
getFilterState in class EventFilter

resetFilter

public void resetFilter()
Description copied from class: EventFilter
should reset the filter to initial state

Specified by:
resetFilter in class EventFilter

filterPacket

public EventPacket filterPacket(EventPacket in)
Description copied from class: EventFilter2D
Subclasses implement this method to define custom processing.

Specified by:
filterPacket in class EventFilter2D
Parameters:
in - the input packet
Returns:
the output packet

isHighwayPerspectiveEnabled

public boolean isHighwayPerspectiveEnabled()

setHighwayPerspectiveEnabled

public void setHighwayPerspectiveEnabled(boolean highwayPerspectiveEnabled)

getMixingFactor

public float getMixingFactor()

setMixingFactor

public void setMixingFactor(float mixingFactor)

getSurround

public float getSurround()
See Also:
setSurround(float)

setSurround

public void setSurround(float surround)
sets scale factor of radius that events outside the cluster size can affect the size of the cluster if scaling is enabled.

Parameters:
surround - the scale factor, constrained >1 by setter. radius is multiplied by this to determine if event is within surround.

isPathsEnabled

public boolean isPathsEnabled()
See Also:
setPathsEnabled(boolean)

setPathsEnabled

public void setPathsEnabled(boolean pathsEnabled)
Parameters:
pathsEnabled - true to show the history of the cluster locations on each packet

getDynamicSizeEnabled

public boolean getDynamicSizeEnabled()
See Also:
setDynamicSizeEnabled(boolean)

setDynamicSizeEnabled

public void setDynamicSizeEnabled(boolean dynamicSizeEnabled)
Enables cluster size scaling. The clusters are dynamically resized by the distances of the events from the cluster center. If most events are far from the cluster then the cluster size is increased, but if most events are close to the cluster center than the cluster size is decreased. The size change for each event comes from mixing the old size with a the event distance from the center using the mixing factor.

Parameters:
dynamicSizeEnabled - true to enable scaling of cluster size

isColorClustersDifferentlyEnabled

public boolean isColorClustersDifferentlyEnabled()
See Also:
setColorClustersDifferentlyEnabled(boolean)

setColorClustersDifferentlyEnabled

public void setColorClustersDifferentlyEnabled(boolean colorClustersDifferentlyEnabled)
Parameters:
colorClustersDifferentlyEnabled - true to color each cluster a different color. false to color each cluster by its age

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

isUseOnePolarityOnlyEnabled

public boolean isUseOnePolarityOnlyEnabled()

setUseOnePolarityOnlyEnabled

public void setUseOnePolarityOnlyEnabled(boolean useOnePolarityOnlyEnabled)

isUseOffPolarityOnlyEnabled

public boolean isUseOffPolarityOnlyEnabled()

setUseOffPolarityOnlyEnabled

public void setUseOffPolarityOnlyEnabled(boolean useOffPolarityOnlyEnabled)

annotate

public void annotate(java.awt.Graphics2D g)
Description copied from interface: FrameAnnotater
each annotator is called by the relevant class (e.g. EyeTracker) and enters annotate with graphics context current, in coordinates with pixel 0,0 in UL corner and pixel spacing 1 unit before scaling transform (which is already active).

Specified by:
annotate in interface FrameAnnotater
Parameters:
g - the Graphics2D context

drawBox

protected void drawBox(javax.media.opengl.GL gl,
                       int x,
                       int y,
                       int sx,
                       int sy)

annotate

public void annotate(javax.media.opengl.GLAutoDrawable drawable)
Description copied from interface: FrameAnnotater
Each annotator enters annotate with graphics context current, in coordinates with pixel 0,0 in LL corner (note opposite from Java2D) and pixel spacing 1 unit after the scaling transform (which is already active). The FrameAnnotater then can use JOGL calls to render to the screen by getting the GL context, e.g. the following code, used in the context of an AEChip object, draws a golden lines from LL to UR of the pixel array.
        GL gl = drawable.getGL();
        gl.glBegin(GL.GL_LINES);
        gl.glColor3f(.5f, .5f, 0);
        gl.glVertex2f(0, 0);
        gl.glVertex2f(getSizeX() - 1, getSizeY() - 1);
        gl.glEnd();
 

Specified by:
annotate in interface FrameAnnotater
Parameters:
drawable - the OpenGL drawable components, e.g., GLCanvas

annotate

public void annotate(float[][][] frame)
annotate the rendered retina frame to show locations of clusters

Specified by:
annotate in interface FrameAnnotater
Parameters:
frame - the RGB pixel information. First dimension is Y, second is X, third is RGB

isGrowMergedSizeEnabled

public boolean isGrowMergedSizeEnabled()

setGrowMergedSizeEnabled

public void setGrowMergedSizeEnabled(boolean growMergedSizeEnabled)

getVelocityMixingFactor

public float getVelocityMixingFactor()

setVelocityMixingFactor

public void setVelocityMixingFactor(float velocityMixingFactor)

setShowVelocity

public void setShowVelocity(boolean showVelocity)

isShowVelocity

public boolean isShowVelocity()

isLogDataEnabled

public boolean isLogDataEnabled()

setLogDataEnabled

public void setLogDataEnabled(boolean logDataEnabled)

getAspectRatio

public float getAspectRatio()

setAspectRatio

public void setAspectRatio(float aspectRatio)

isClassifierEnabled

public boolean isClassifierEnabled()

setClassifierEnabled

public void setClassifierEnabled(boolean classifierEnabled)
Sets whether classifier is enabled.

Parameters:
classifierEnabled - true to enable classifier

getClassifierThreshold

public float getClassifierThreshold()

setClassifierThreshold

public void setClassifierThreshold(float classifierThreshold)

isShowAllClusters

public boolean isShowAllClusters()

setShowAllClusters

public void setShowAllClusters(boolean showAllClusters)
Sets annotation visibility of clusters that are not "visible"

Parameters:
showAllClusters - true to show all clusters even if there are not "visible"

isDynamicAspectRatioEnabled

public boolean isDynamicAspectRatioEnabled()

setDynamicAspectRatioEnabled

public void setDynamicAspectRatioEnabled(boolean dynamicAspectRatioEnabled)

getPredictiveVelocityFactor

public int getPredictiveVelocityFactor()

setPredictiveVelocityFactor

public void setPredictiveVelocityFactor(int predictiveVelocityFactor)

setEntry_xa

public void setEntry_xa(int entry_xa)

getEntry_xa

public int getEntry_xa()

setEntry_xb

public void setEntry_xb(int entry_xb)

getEntry_xb

public int getEntry_xb()

setEntry_ya

public void setEntry_ya(int entry_ya)

getEntry_ya

public int getEntry_ya()

setEntry_yb

public void setEntry_yb(int entry_yb)

getEntry_yb

public int getEntry_yb()

setWrist_xa

public void setWrist_xa(int wrist_xa)

getWrist_xa

public int getWrist_xa()

setWrist_xb

public void setWrist_xb(int wrist_xb)

getWrist_xb

public int getWrist_xb()

setWrist_ya

public void setWrist_ya(int wrist_ya)

getWrist_ya

public int getWrist_ya()

setWrist_yb

public void setWrist_yb(int wrist_yb)

getWrist_yb

public int getWrist_yb()

setPaw_tip_size

public void setPaw_tip_size(int paw_tip_size)

getPaw_tip_size

public int getPaw_tip_size()

setPellet_size

public void setPellet_size(int pellet_size)

getPellet_size

public int getPellet_size()

setEntryZone_threshold

public void setEntryZone_threshold(int entryZone_threshold)

getEntryZone_threshold

public int getEntryZone_threshold()

setEntryZone_pixel_threshold

public void setEntryZone_pixel_threshold(int entryZone_pixel_threshold)

getEntryZone_pixel_threshold

public int getEntryZone_pixel_threshold()

getMax_fingers

public int getMax_fingers()

setMax_fingers

public void setMax_fingers(int max_fingers)

isResetPawTracking

public boolean isResetPawTracking()

setResetPawTracking

public void setResetPawTracking(boolean resetPawTracking)

getChange_ratio

public float getChange_ratio()

setChange_ratio

public void setChange_ratio(float change_ratio)

getMin_events_per_cluster

public int getMin_events_per_cluster()

setMin_events_per_cluster

public void setMin_events_per_cluster(int min_events_per_cluster)

setShowClusters

public void setShowClusters(boolean showClusters)

isShowClusters

public boolean isShowClusters()

setShowFingers

public void setShowFingers(boolean showFingers)

isShowFingers

public boolean isShowFingers()

jAER project on SourceForge