jAER project on SourceForge

ch.unizh.ini.jaer.projects.gesture
Class GestureTracker.Cluster

java.lang.Object
  extended by ch.unizh.ini.jaer.projects.gesture.GestureTracker.Cluster
Enclosing class:
GestureTracker

public class GestureTracker.Cluster
extends java.lang.Object

Represents a single tracked object


Field Summary
protected  java.awt.Color color
           
protected  float distanceToLastEvent
           
protected  int firstTimestamp
           
protected  float instantaneousEventRate
           
protected  float instantaneousISI
           
protected  int lastTimestamp
           
 java.awt.geom.Point2D.Float location
          location of cluster in pixels
protected  int MAX_PATH_LENGTH
           
protected  int numEvents
           
protected  java.util.ArrayList<java.awt.geom.Point2D.Float> path
           
 java.awt.geom.Point2D.Float velocity
          velocity of cluster in pixels/tick, where tick is timestamp tick (usually microseconds)
 
Constructor Summary
GestureTracker.Cluster()
           
GestureTracker.Cluster(BasicEvent ev)
           
GestureTracker.Cluster(GestureTracker.Cluster one, GestureTracker.Cluster two)
          Constructs a cluster by merging two clusters.
 
Method Summary
 void addEvent(BasicEvent event)
           
 float distanceMetric(float dx, float dy)
           
protected  float distanceTo(GestureTracker.Cluster c)
           
 float getAspectRatio()
           
 float getAverageEventDistance()
           
 float getAvgEventRate()
           
 float getAvgISI()
           
 int getClusterNumber()
           
 java.awt.Color getColor()
           
 int getLastEventTimestamp()
           
 int getLifetime()
           
 java.awt.geom.Point2D.Float getLocation()
           
 float getMeasuredSizeCorrectedByPerspective()
          Computes the size of the cluster based on average event distance and adjusted for perpective scaling.
 java.util.ArrayList<java.awt.geom.Point2D.Float> getPath()
           
 float getRadius()
           
 float getRadiusCorrectedForPerspective()
           
 java.awt.geom.Point2D.Float getVelocity()
           
 boolean isVisible()
           
 void setAspectRatio(float aspectRatio)
           
 void setAverageEventDistance(float averageEventDistance)
           
 void setAvgEventRate(float avgEventRate)
           
 void setAvgISI(float avgISI)
           
 void setClusterNumber(int clusterNumber)
           
 void setColor(java.awt.Color color)
           
 void setColorAccordingToAge()
          Sets color according to age of cluster
 void setColorAccordingToClass()
           
 void setColorAccordingToQuadrant(int x, int y)
           
 void setColorAccordingToSize()
          Sets color according to measured cluster size
 void setColorAutomatically()
           
 void setLocation(java.awt.geom.Point2D.Float l)
           
 void setRadius(float r)
          the radius of a cluster is the distance in pixels from the cluster center that is the putative model size.
 java.lang.String toString()
           
 void updatePath()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

location

public java.awt.geom.Point2D.Float location
location of cluster in pixels


velocity

public java.awt.geom.Point2D.Float velocity
velocity of cluster in pixels/tick, where tick is timestamp tick (usually microseconds)


MAX_PATH_LENGTH

protected final int MAX_PATH_LENGTH
See Also:
Constant Field Values

path

protected java.util.ArrayList<java.awt.geom.Point2D.Float> path

color

protected java.awt.Color color

numEvents

protected int numEvents

lastTimestamp

protected int lastTimestamp

firstTimestamp

protected int firstTimestamp

instantaneousEventRate

protected float instantaneousEventRate

instantaneousISI

protected float instantaneousISI

distanceToLastEvent

protected float distanceToLastEvent
Constructor Detail

GestureTracker.Cluster

public GestureTracker.Cluster()

GestureTracker.Cluster

public GestureTracker.Cluster(BasicEvent ev)

GestureTracker.Cluster

public GestureTracker.Cluster(GestureTracker.Cluster one,
                              GestureTracker.Cluster two)
Constructs a cluster by merging two clusters. All parameters of the resulting cluster should be reasonable combinations of the source cluster parameters. For example, the merged location values are weighted by the number of events that have supported each source cluster, so that older clusters weigh more heavily in the resulting cluster location. Subtle bugs or poor performance can result from not properly handling the merging of parameters.

Parameters:
one - the first cluster
two - the second cluster
Method Detail

getLastEventTimestamp

public int getLastEventTimestamp()

addEvent

public void addEvent(BasicEvent event)

distanceMetric

public float distanceMetric(float dx,
                            float dy)

distanceTo

protected final float distanceTo(GestureTracker.Cluster c)
Returns:
distance of this cluster to the other cluster

getRadiusCorrectedForPerspective

public float getRadiusCorrectedForPerspective()
Returns:
the absolute size of the cluster after perspective correction, i.e., a large cluster at the bottom of the scene is the same absolute size as a smaller cluster higher up in the scene.

getRadius

public final float getRadius()

setRadius

public void setRadius(float r)
the radius of a cluster is the distance in pixels from the cluster center that is the putative model size. If highwayPerspectiveEnabled is true, then the radius is set to a fixed size depending on the defaultClusterRadius and the perspective location of the cluster and r is ignored. The aspect ratio parameters of the cluster are also set.

Parameters:
r - the radius in pixels

getLocation

public final java.awt.geom.Point2D.Float getLocation()

setLocation

public void setLocation(java.awt.geom.Point2D.Float l)

isVisible

public final boolean isVisible()
Returns:
true if cluster has enough support

getLifetime

public final int getLifetime()
Returns:
lifetime of cluster in timestamp ticks

updatePath

public final void updatePath()

toString

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

getPath

public java.util.ArrayList<java.awt.geom.Point2D.Float> getPath()

getColor

public java.awt.Color getColor()

setColor

public void setColor(java.awt.Color color)

getVelocity

public java.awt.geom.Point2D.Float getVelocity()
Returns:
averaged velocity of cluster in pixels per second. The velocity is instantaneously computed from the movement of the cluster caused by the last event, then this velocity is mixed with the the old velocity by the mixing factor. Thus the mixing factor is appplied twice: once for moving the cluster and again for changing the velocity.

getAverageEventDistance

public float getAverageEventDistance()
Returns:
average (mixed by GestureTracker.mixingFactor) distance from events to cluster center

setAverageEventDistance

public void setAverageEventDistance(float averageEventDistance)
See Also:
getAverageEventDistance()

getMeasuredSizeCorrectedByPerspective

public float getMeasuredSizeCorrectedByPerspective()
Computes the size of the cluster based on average event distance and adjusted for perpective scaling. A large cluster at botton of screen is the same size as a smaller cluster closer to horizon

Returns:
size of cluster in pizels

setColorAccordingToSize

public void setColorAccordingToSize()
Sets color according to measured cluster size


setColorAccordingToQuadrant

public void setColorAccordingToQuadrant(int x,
                                        int y)

setColorAccordingToAge

public void setColorAccordingToAge()
Sets color according to age of cluster


setColorAccordingToClass

public void setColorAccordingToClass()

setColorAutomatically

public void setColorAutomatically()

getClusterNumber

public int getClusterNumber()

setClusterNumber

public void setClusterNumber(int clusterNumber)

getAvgISI

public float getAvgISI()
Returns:
average ISI for this cluster in timestamp ticks. Average is computed using cluster location mising factor.

setAvgISI

public void setAvgISI(float avgISI)

getAvgEventRate

public float getAvgEventRate()
Returns:
average event rate in spikes per timestamp tick. Average is computed using location mixing factor. Note that this measure emphasizes the high spike rates because a few events in rapid succession can rapidly push up the average rate.

setAvgEventRate

public void setAvgEventRate(float avgEventRate)

getAspectRatio

public float getAspectRatio()

setAspectRatio

public void setAspectRatio(float aspectRatio)

jAER project on SourceForge