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
|
(
Set the threshold for connectable measurements until there is a prediction. |
|
void
|
(
Set the prediction threshold. |
|
void
|
( )
Sort trajectories using the trajectory type's LessThan comparison functor. |
Protected member functions
|
Extends |
|
|
double
|
Measure the likelihood of |
|
virtual double
|
Evaluate the likelihood that |
|
virtual void
|
(
Create a prediction for all trajectories at time instant
|
|
virtual MeasurementType *
|
Predict the location of a measurement at the time instant
|
Function details
-
PiiCoordinateTracker
()Create a new coordinate tracker.
-
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
trajectoryby 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
measurementbelonging totrajectoryat time instantt.The default implementation computes squared distance between
measurementand 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,
measurementwill 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
measurementwork 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
measurementis a starting point of a new trajectory.The default implementation returns 1.0 when
tis 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
tgiven 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.
Add a note
Not a single note added yet. Be the first, add yours.