Image Component Library (ICL)
|
Extension of the position tracker class for N-dimensional positions. More...
#include <VectorTracker.h>
Public Types | |
enum | IDmode { firstFree, brandNew } |
Determines how ids are allocated internally. More... | |
typedef std::vector< float > | Vec |
Vector Type. | |
Public Member Functions | |
VectorTracker () | |
Creates an empty (null) vector tracker (isNull() returns true then) | |
VectorTracker (int dim, float largeDistance, const std::vector< float > &normFactors=std::vector< float >(), IDmode idMode=firstFree, float distanceThreshold=0, bool tryOpt=true) | |
Creates new VectorTracker instance with given parameters. | |
VectorTracker (const VectorTracker &other) | |
Deep copy constructor (all data and current state is copied deeply) | |
VectorTracker & | operator= (const VectorTracker &other) |
assignment (all data and current state is copied deeply) | |
~VectorTracker () | |
Destructor. | |
void | pushData (const std::vector< Vec > &newData) |
next step function most efficient version | |
int | getID (int index) const |
returns runtime id of last pushed data element index | |
bool | isNull () const |
returns whether VectorTracker instance is currently null (created with default constructor) | |
int | getDim () const |
return current data dimension | |
void | setExtrapolationMask (const std::vector< bool > &mask) |
internally sets the extrapolation mask | |
const std::vector< bool > & | getExtrapolationMask () const |
returns current extrapolation mask | |
Private Attributes | |
Data * | m_data |
internal data pointer |
Extension of the position tracker class for N-dimensional positions.
Here's a copy of the PositionTracker documentation, which assumes 2D-input data:
Class for tracking 2D positions.
typedef std::vector<float> icl::cv::VectorTracker::Vec |
Vector Type.
Creates an empty (null) vector tracker (isNull() returns true then)
icl::cv::VectorTracker::VectorTracker | ( | int | dim, |
float | largeDistance, | ||
const std::vector< float > & | normFactors = std::vector< float >() , |
||
IDmode | idMode = firstFree , |
||
float | distanceThreshold = 0 , |
||
bool | tryOpt = true |
||
) |
Creates new VectorTracker instance with given parameters.
dim | data dimension (this must not changed at runtime) |
largeDistance | to tackle element count changes, the distance matrix is padded with largeDistnace values, this must be much (e.g. 100 times ) larger then the largest real distance, that can be expected from the data. We can't use some fixed value here, as too large values lead to numerical problems |
normFactors | Internally the euclidian distance metric can be normalized in differenct dimensions seperately: In literature this is norm is reference as normalized euclidian distance. Actually we use an adapted instance of this norm: As mentioned in the documentation of the PositionTracker, it's compulsory to use the root of the actual norm to avoid new entries are mixed up with old ones. The norm factor vector contains the that are used in the formula above. If norm-factor is empty or all entries are set to 1, the default euclidian norm (more precisely the square root of it) is used, which increases performance slightly. If normFactor contains zeros, div-0 errors would occur, so this is checked during initialization. |
idMode | This feature is taken from the recent PositionTracker update. It decides whether to re-use old IDs, that got free again due to the disappearing of the associated entry or to assign a brand new ID each time a new entry is found |
distanceThreshold | As a first optimization a trivial assignment is tested. If entry count hasn't changed and each old entry can be assigned indisputably to a single new entry and each distance between estimation and current observation is beyond that threshold, the trivial assignment is used. |
tryOpt | enables/disables whether to test for trivial assignment. If a trivial assignment can be expected, this will increase performance significantly. If it's more likely, that trivial assignment will fail, this also reduce performance a little bit. |
icl::cv::VectorTracker::VectorTracker | ( | const VectorTracker & | other | ) |
Deep copy constructor (all data and current state is copied deeply)
New instance is absolutely independent from the source instance
Destructor.
int icl::cv::VectorTracker::getDim | ( | ) | const |
return current data dimension
const std::vector<bool>& icl::cv::VectorTracker::getExtrapolationMask | ( | ) | const |
returns current extrapolation mask
int icl::cv::VectorTracker::getID | ( | int | index | ) | const |
returns runtime id of last pushed data element index
bool icl::cv::VectorTracker::isNull | ( | ) | const |
returns whether VectorTracker instance is currently null (created with default constructor)
VectorTracker& icl::cv::VectorTracker::operator= | ( | const VectorTracker & | other | ) |
assignment (all data and current state is copied deeply)
New instance is absolutely independent from the source instance
void icl::cv::VectorTracker::pushData | ( | const std::vector< Vec > & | newData | ) |
next step function most efficient version
void icl::cv::VectorTracker::setExtrapolationMask | ( | const std::vector< bool > & | mask | ) |
internally sets the extrapolation mask
By default, the mask contains only true-entries. All dimensions of current date, that have a true-entry in the mask are extrapolated using a linear model before the internal cost-matrix is created (and if this entry has an age of at least 2 -- so two former entries are available). Dimensions that have a false-entry in the given mask are not-extrapolated over time (which is identical to using a constant extrapolation model)
Data* icl::cv::VectorTracker::m_data [private] |
internal data pointer