jAER project on SourceForge

net.sf.jaer.eventprocessing.tracking
Class RectangularClusterTracker.Cluster

java.lang.Object
  extended by net.sf.jaer.eventprocessing.tracking.RectangularClusterTracker.Cluster
Direct Known Subclasses:
StereoClusterTracker.StereoCluster
Enclosing class:
RectangularClusterTracker

public class RectangularClusterTracker.Cluster
extends java.lang.Object


Nested Class Summary
 class RectangularClusterTracker.Cluster.PathPoint
           
 
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 numEvents
           
protected  java.util.ArrayList<RectangularClusterTracker.Cluster.PathPoint> path
           
protected  int previousNumEvents
           
protected  java.awt.geom.Point2D.Float velocity
          velocity of cluster in pixels/tick, where tick is timestamp tick (usually microseconds)
 
Constructor Summary
RectangularClusterTracker.Cluster()
           
RectangularClusterTracker.Cluster(BasicEvent ev)
           
RectangularClusterTracker.Cluster(RectangularClusterTracker.Cluster one, RectangularClusterTracker.Cluster two)
          Constructs a cluster by merging two clusters.
 
Method Summary
 void addEvent(BasicEvent event)
          updates cluster by one event.
 float distanceMetric(float dx, float dy)
           
protected  float distanceTo(RectangularClusterTracker.Cluster c)
           
 float getAngle()
           
 float getAspectRatio()
           
 float getAverageEventDistance()
           
 float getAvgEventRate()
           
 float getAvgISI()
           
 java.awt.geom.Point2D.Float getBirthLocation()
           
 int getClusterNumber()
           
 java.awt.Color getColor()
           
 float getDistanceFromBirth()
          Computes and returns the total absolute distance (shortest path) traveled in pixels since the birth of this cluster
 float getDistanceXFromBirth()
           
 float getDistanceYFromBirth()
           
 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<RectangularClusterTracker.Cluster.PathPoint> getPath()
           
 float getRadius()
           
 float getRadiusCorrectedForPerspective()
           
 java.awt.geom.Point2D.Float getVelocityPPS()
           
 boolean isVelocityValid()
           
 boolean isVisible()
           
 void setAngle(float angle)
           
 void setAspectRatio(float aspectRatio)
           
 void setAverageEventDistance(float averageEventDistance)
           
 void setAvgEventRate(float avgEventRate)
           
 void setAvgISI(float avgISI)
           
 void setBirthLocation(java.awt.geom.Point2D.Float birthLocation)
           
 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 setRadius(float r)
          the radius of a cluster is the distance in pixels from the cluster center that is the putative model size.
 void setVelocityValid(boolean velocityValid)
           
 java.lang.String toString()
           
 void updatePath(EventPacket<?> in)
          Updates path (historical) information for this cluster, including cluster velocity.
 
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

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


path

protected java.util.ArrayList<RectangularClusterTracker.Cluster.PathPoint> path

color

protected java.awt.Color color

numEvents

protected int numEvents

previousNumEvents

protected int previousNumEvents

lastTimestamp

protected int lastTimestamp

firstTimestamp

protected int firstTimestamp

instantaneousEventRate

protected float instantaneousEventRate

instantaneousISI

protected float instantaneousISI

distanceToLastEvent

protected float distanceToLastEvent
Constructor Detail

RectangularClusterTracker.Cluster

public RectangularClusterTracker.Cluster()

RectangularClusterTracker.Cluster

public RectangularClusterTracker.Cluster(BasicEvent ev)

RectangularClusterTracker.Cluster

public RectangularClusterTracker.Cluster(RectangularClusterTracker.Cluster one,
                                         RectangularClusterTracker.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)
updates cluster by one event. The cluster velocity is updated at the filterPacket level after all events in a packet are added.

Parameters:
event - the event

distanceMetric

public float distanceMetric(float dx,
                            float dy)

distanceTo

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

getDistanceFromBirth

public float getDistanceFromBirth()
Computes and returns the total absolute distance (shortest path) traveled in pixels since the birth of this cluster

Returns:
distance in pixels since birth of cluster

getDistanceYFromBirth

public float getDistanceYFromBirth()
Returns:
signed distance in Y from birth

getDistanceXFromBirth

public float getDistanceXFromBirth()
Returns:
signed distance in X from birth

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(EventPacket<?> in)
Updates path (historical) information for this cluster, including cluster velocity.


toString

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

getPath

public java.util.ArrayList<RectangularClusterTracker.Cluster.PathPoint> getPath()

getColor

public java.awt.Color getColor()

setColor

public void setColor(java.awt.Color color)

getVelocityPPS

public java.awt.geom.Point2D.Float getVelocityPPS()
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 RectangularClusterTracker.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)

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)

getAngle

public float getAngle()

setAngle

public void setAngle(float angle)

getBirthLocation

public java.awt.geom.Point2D.Float getBirthLocation()

setBirthLocation

public void setBirthLocation(java.awt.geom.Point2D.Float birthLocation)

isVelocityValid

public boolean isVelocityValid()

setVelocityValid

public void setVelocityValid(boolean velocityValid)

jAER project on SourceForge