jAER project on SourceForge

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

java.lang.Object
  extended by ch.unizh.ini.jaer.projects.pawtracker.PawTracker.Cluster
Enclosing class:
PawTracker

public class PawTracker.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
           
protected  int type
           
 java.awt.geom.Point2D.Float velocity
          velocity of cluster in pixels/tick, where tick is timestamp tick (usually microseconds)
 
Constructor Summary
PawTracker.Cluster()
           
PawTracker.Cluster(int x, int y, int type, int numEvents, int timestamp, int radius)
           
PawTracker.Cluster(PawTracker.Cluster one, PawTracker.Cluster two)
          Constructs a cluster by merging two clusters.
PawTracker.Cluster(TypedEvent ev)
           
 
Method Summary
 void addEvent(BasicEvent event)
           
 float distanceMetric(float dx, float dy)
           
protected  float distanceTo(PawTracker.Cluster c)
           
 float getAspectRatio()
           
 float getAverageEventDistance()
           
 float getAvgEventRate()
           
 float getAvgISI()
           
 int getClusterNumber()
           
 java.awt.Color getColor()
           
 int getEntryZoneXa()
           
 int getEntryZoneXb()
           
 int getEntryZoneYa()
           
 int getEntryZoneYb()
           
 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.
 int getNbEvents()
           
 int getNbOppositeEvents()
           
 java.util.ArrayList<java.awt.geom.Point2D.Float> getPath()
           
 float getRadius()
           
 float getRadiusCorrectedForPerspective()
           
 int getType()
           
 java.awt.geom.Point2D.Float getVelocity()
           
 void incNbEvents()
           
 void incNbOppositeEvents()
           
 boolean isVisible()
           
 void resetNbEvents()
           
 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 setColorAccordingToSize()
          Sets color according to measured cluster size
 void setColorAutomatically()
           
 void setLocation(java.awt.geom.Point2D.Float l)
           
 void setNbEvents(int nbEvents)
           
 void setNbOppositeEvents(int nbOppositeEvents)
           
 void setRadius(float r)
          the radius of a cluster is the distance in pixels from the cluster center that is the putative model size.
 void setType(int type)
           
 void setTypeAndColor(int type)
           
 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

type

protected int type

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

PawTracker.Cluster

public PawTracker.Cluster()

PawTracker.Cluster

public PawTracker.Cluster(TypedEvent ev)

PawTracker.Cluster

public PawTracker.Cluster(int x,
                          int y,
                          int type,
                          int numEvents,
                          int timestamp,
                          int radius)

PawTracker.Cluster

public PawTracker.Cluster(PawTracker.Cluster one,
                          PawTracker.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

resetNbEvents

public void resetNbEvents()

getLastEventTimestamp

public int getLastEventTimestamp()

addEvent

public void addEvent(BasicEvent event)

distanceMetric

public float distanceMetric(float dx,
                            float dy)

distanceTo

protected final float distanceTo(PawTracker.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)

getType

public int getType()

setType

public void setType(int type)

setTypeAndColor

public void setTypeAndColor(int type)

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 PawTracker.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


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)

getEntryZoneXa

public int getEntryZoneXa()
Returns:
coordinates of entry zone

getEntryZoneXb

public int getEntryZoneXb()

getEntryZoneYa

public int getEntryZoneYa()

getEntryZoneYb

public int getEntryZoneYb()

getNbEvents

public int getNbEvents()
Returns:
number of events in this cluster for the current timestep.

setNbEvents

public void setNbEvents(int nbEvents)

incNbEvents

public void incNbEvents()

getNbOppositeEvents

public int getNbOppositeEvents()
Returns:
number of events of opposite type in this cluster for the current timestep so that we can compute change of direction when high proportion of events if from the other type

setNbOppositeEvents

public void setNbOppositeEvents(int nbOppositeEvents)

incNbOppositeEvents

public void incNbOppositeEvents()

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