classPiiExtendedCoordinateTracker
#include <PiiExtendedCoordinateTracker.h>
A tracker that follows trajectories in D dimensions.
Inherits PiiCoordinateTracker< T, D >
Description
It extends PiiCoordinateTracker by adding more sophisticated trajectory management facilities. PiiExtendedCoordinateTracker has the following properties:
-
Predicts constant movement for all objects based on two latest measurements.
-
New trajectories will be created for measurements that are either not connected to a trajectory or connected with a bad fitness value (see setGoodFitnessThreshold()). The fitness of such a new trajectory will be 1.0 - the maximum fitness compared to any candidate trajectory.
-
If a trajectory cannot be reliably continued (see setGoodFitnessThreshold()), the trajectory will be retained in candidate trajectories without extending it. This enhancement is needed to cope with missing measurements. Such trajectories are extended by cloning the last trajectory node.
-
If a trajectory has not been extended with new measurements for N (#setMaxStopTime()) iterations, it will be killed (endTrajectories()).
Public types
|
typedef PiiVector< T, D
>
|
|
|
typedef PiiCoordinateTracker<
T, D >
|
|
|
typedef PiiCoordinateTrackerNode<
T, D >
|
Constructors and destructor
Public member functions
|
virtual void
|
Add new measurements to the tracker. |
|
double
|
Get the current good fitness threshold. |
|
int
|
Get the current maximum prediction length. |
|
int
|
( )
Get the maximum stop time. |
|
void
|
(
Set the threshold for good fitness. |
|
void
|
(
The maximum number of trajectory nodes between samples used for movement prediction. |
|
void
|
(
The maximum time a trajectory will stay alive without any measurements connected to it. |
Protected member functions
|
virtual void
|
Called when the tracker decides to get rid of a set of trajectories. |
|
double
|
Measure the likelihood of |
|
virtual double
|
Evaluate the likelihood that |
|
virtual MeasurementType *
|
Predict the location of a measurement at the time instant
|
Function details
-
PiiExtendedCoordinateTracker
()[inline] -
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 PiiCoordinateTracker.
-
double goodFitnessThreshold
()[inline]Get the current good fitness threshold.
-
int maximumPredictionLength
()[inline]Get the current maximum prediction length.
-
int maximumStopTime
()[inline]Get the maximum stop time.
-
void setGoodFitnessThreshold
(- double goodFitnessThreshold
[inline]Set the threshold for good fitness.
"Good fitness" is a level of fitness that indicates a measurement is pretty close to the predicted position. Fitness values are within [0,1].
The "good fitness" threshold is used in deciding whether a measurement can form a new candidate trajectory or not. If the maximum fitness of a sample compared to any of the current set of trajectories is less than or equal to this threshold, a new candidate will be formed. The fitness of the new trajectory will be 1.0 - the maximum fitness.
If a trajectory cannot be extended with a measurement whose fitness greater than this value, a new candidate will be created by cloning the current end point of the trajectory. The default value, 0.0, causes the tracker to create a new trajectory only if the measurement cannot be connected to any of the current candidate trajectories.
-
void setMaximumPredictionLength
(- int maximumPredictionLength
[inline]The maximum number of trajectory nodes between samples used for movement prediction.
The default value is 1, which means that the difference between two previous samples will always be used. Setting the maximum prediction length to a larger value makes the estimate skip more samples in between, which should make the estimate more robust.
Parameters
- maximumPredictionLength
-
the maximum distance between nodes used for velocity estimation.
-
void setMaximumStopTime
(- int maximumStopTime
[inline]The maximum time a trajectory will stay alive without any measurements connected to it.
If this much time passes and a trajectory has not been extended, it needs to be ended. The tracker collects all such trajectories into a list it passes to endTrajectories().
Parameters
- maximumStopTime
-
the maximum amount of time a trajectory stays alive without measurements connected to it. The time is expressed in the units given as the
tparameter toaddMeasurements(). The default value is 1.
-
virtual void endTrajectories
[inline, protected, virtual]Called when the tracker decides to get rid of a set of trajectories.
Subclasses may perform any functionality needed to close the trajectory in their overridden implementation. The default implementation deletes all trajectories. If you don't delete the trajectories yourself, make sure you remember to call this function in your overridden function.
Parameters
- trajectories
-
the trajectories that are just about to pass away. The ended trajectories will appear in this list in the same order they appeared in trajectories.
- t
-
the current time instant
-
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.Reimplemented from PiiCoordinateTracker.
-
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.
Reimplemented from PiiCoordinateTracker.
-
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.
Reimplemented from PiiCoordinateTracker.
Add a note
Not a single note added yet. Be the first, add yours.