Into

Modules

Documentation

classPiiCoordinateTracker

#include <PiiCoordinateTracker.h>

PiiCoordinateTracker tracks points in Cartesian coordinates.

Inherits PiiMultiHypothesisTracker< PiiVector< T, D >, PiiCoordinateTrackerNode< T, D > * >

Inherited by PiiConstantVelocityTracker< T, D >, PiiExtendedCoordinateTracker< T, D >

Description

This class does not yet implement the measurement model. It merely augments PiiMultiHypothesisTracker by using PiiTrackerPoint* as the measurement type and by adding facilities for managing measurements and trajectories.

PiiCoordinateTracker tracks coordinates in a D -dimensional space. The coordinates can be expressed as any data type, T. Evaluation of new measurements is based on predictions. A prediction is derived from an existing trajectory, and the distance between a new measurement and the prediction works as a measure of goodness.

Public types

typedef PiiVector< T, D >
typedef PiiCoordinateTrackerNode< T, D >

Constructors and destructor

Create a new coordinate tracker.

Public member functions

virtual void
( )

Add new measurements to the tracker.

void
( )

A utility function that makes it possible to use a matrix to set the measurements at once.

double

Get the initial threshold.

double

Get the current prediction threshold.

void
(
  • double initialThreshold
)

Set the threshold for connectable measurements until there is a prediction.

void
(
  • double predictionThreshold
)

Set the prediction threshold.

void

Sort trajectories using the trajectory type's LessThan comparison functor.

Protected member functions

( )

Extends trajectory by adding a new PiiCoordinateTrackerNode to the end of the linked list.

double
( )

Measure the likelihood of measurement belonging to trajectory at time instant t.

virtual double
( )

Evaluate the likelihood that measurement is a starting point of a new trajectory.

virtual void
(
  • int t
)

Create a prediction for all trajectories at time instant t.

virtual MeasurementType *
( )

Predict the location of a measurement at the time instant t given a trajectory.

Function details

  • PiiCoordinateTracker

    ()

    Create a new coordinate tracker.

  • virtual void addMeasurements

    ( )
    [virtual]

    Add new measurements to the tracker.

    This function first creates a prediction for each active trajectory and then runs the tracking algorithm.

     PiiCoordinateTracker<int,2> tracker;
     typedef PiiTrackerPoint<int,2> Point;
     tracker.addMeasurements(QList<Point>() << Point(1,2) << Point(-1, 3), 0);
     tracker.addMeasurements(QList<Point>() << Point(4,3) << Point(-2, 5) << Point(-4, 8), 1);
    

    Reimplemented from PiiMultiHypothesisTracker.

  • void addMeasurements

    ( )

    A utility function that makes it possible to use a matrix to set the measurements at once.

     PiiCoordinateTracker<int,2> tracker;
     tracker.addMeasurements(PiiMatrix<int>(2, 2,
                                            1, 2,
                                           -1, 3));
    
    Parameters
    measurements

    a N-by-D matrix. Each row represents a measurement point. If the number of columns in the matrix does not equal D, the function does nothing.

    t
  • double initialThreshold

    ()
    [inline]

    Get the initial threshold.

  • double predictionThreshold

    ()
    [inline]

    Get the current prediction threshold.

  • void setInitialThreshold

    (
    • double initialThreshold
    )
    [inline]

    Set the threshold for connectable measurements until there is a prediction.

    If the squared distance between measurements is less than this threshold, the measurements can be connected, and #measureFit(TrajectoryType**,const MeasurementType&,int) will return 1.0. If it is more, 0.0 will be returned. The default threshold is 1.

  • void setPredictionThreshold

    (
    • double predictionThreshold
    )
    [inline]

    Set the prediction threshold.

    If the squared distance to a measurement is larger than or equal to this value, #measureFit(TrajectoryType**,const MeasurementType&,int) will return zero. The default threshold is 1.

  • void sortTrajectories

    ()

    Sort trajectories using the trajectory type's LessThan comparison functor.

    If the trajectory type is PiiCoordinateTrackerNode, the results is that trajectories will be sorted in descending order based on the trajectory fitness. If you want to reverse the order, do something like the following:

     typedef PiiCoordinateTrackerNode<double,2> TrajectoryType;
     PiiCoordinateTracker<double,2> tracker;
     QList<TrajectoryType> trajectories = tracker.trajectories();
     qSort(trajectories.begin(), trajectories.end(), TrajectoryType::GreaterThan());
    
    See also
  • TrajectoryType * createTrajectory

    ( )
    [protected]

    Extends trajectory by adding a new PiiCoordinateTrackerNode to the end of the linked list.

    The measurement will be stored into the new node.

  • double measureFit

    ( )
    [protected]

    Measure the likelihood of measurement belonging to trajectory at time instant t.

    The default implementation computes squared distance between measurement and the trajectory's prediction (predict()). If they are equal, 1.0 will be returned. The returned value decreases linearly towards zero with (squared) distance until predictionThreshold is reached.

    If there is no prediction, measurement will be compared to the trajectory's last point. If the squared distance is within initialThreshold, 1.0 will be returned. Otherwise, 0.0 will be returned.

    Should measurement work as a starting point for a new trajectory, the tracker consults the measureFit(const MeasurementType&, int) function.

  • virtual double measureFit

    ( )
    [inline, protected, virtual]

    Evaluate the likelihood that measurement is a starting point of a new trajectory.

    The default implementation returns 1.0 when t is zero, 0.0 otherwise. This creates new trajectories on the first iteration only.

    Parameters
    measurement

    the measurement

    t

    the time instant

    Returns

    the likelihood (0-1) of the measurement being a new starting point.

  • virtual void predict

    (
    • int t
    )
    [inline, protected, virtual]

    Create a prediction for all trajectories at time instant t.

    The default implementation loops through the trajectories and calls predict(TrajectoryType*, int) for each trajectory.

  • virtual MeasurementType * predict

    ( )
    [inline, protected, virtual]

    Predict the location of a measurement at the time instant t given a trajectory.

    The function should return a pointer to a newly allocated measurement object. The tracker assumes the ownership of the pointer. If a prediction cannot be derived yet, zero must be returned. You need to implement this function as your movement model The default implementation returns 0.

    Parameters
    trajectory

    the trajectory on which the prediction will be based

    t

    the time instant for which the prediction should be given. The coordinate tracker always requests forward predictions, but it is in principle possible to predict backwards as well.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.