-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtracker.cpp
More file actions
35 lines (30 loc) · 988 Bytes
/
tracker.cpp
File metadata and controls
35 lines (30 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "tracker.hpp"
/* Tracker::CTraerckcartTt cv::Point2f &p, float dt, float accelNoiseMag, int trackID ) {{{*/
Tracker::Tracker( const cv::Point2f &p, float dt, float accelNoiseMag, int trackID )
:
trackId( trackID ),
skippedFrames( 0 ),
prediction( p ),
KF( p, dt, accelNoiseMag )
{
}
/* }}} */
/* float Tracker::calcDist( const cv::Point2f &p ) {{{*/
float Tracker::calcDist( const cv::Point2f &p )
{
cv::Point2f diff = prediction - p;
return sqrtf( diff.x * diff.x + diff.y * diff.y );
}
/* }}} */
/* void Tracker::update( const cv::Point2f &p, bool dataCorrect, int maxTraceLength ) {{{*/
void Tracker::update( const cv::Point2f &p, bool dataCorrect, int maxTraceLength )
{
KF.GetPrediction();
prediction = KF.Update( p, dataCorrect );
if ( trackedPts.size() > ( uint )maxTraceLength )
{
trackedPts.erase( trackedPts.begin(), trackedPts.end() - maxTraceLength );
}
trackedPts.push_back( prediction );
}
/* }}} */