Loading...
Searching...
No Matches
KalmanTracker.h
Go to the documentation of this file.
// © OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
// KalmanTracker.h: KalmanTracker Class Declaration
#ifndef KALMAN_H
#define KALMAN_H 2
#include "opencv2/video/tracking.hpp"
#include "opencv2/highgui/highgui.hpp"
#define StateType cv::Rect_<float>
class KalmanTracker
{
public:
KalmanTracker()
{
init_kf(StateType());
m_time_since_update = 0;
m_hits = 0;
m_hit_streak = 0;
m_age = 0;
m_id = 0;
}
KalmanTracker(StateType initRect, float confidence, int classId, int objectId) : confidence(confidence), classId(classId)
{
init_kf(initRect);
m_time_since_update = 0;
m_hits = 0;
m_hit_streak = 0;
m_age = 0;
m_id = objectId;
}
~KalmanTracker()
{
m_history.clear();
}
StateType predict();
StateType predict2();
void update(StateType stateMat);
StateType get_state();
StateType get_rect_xysr(float cx, float cy, float s, float r);
int m_time_since_update;
int m_hits;
int m_hit_streak;
int m_age;
int m_id;
float confidence;
int classId;
private:
void init_kf(StateType stateMat);
cv::KalmanFilter kf;
cv::Mat measurement;
std::vector<StateType> m_history;
};
#endif
StateType
#define StateType
Definition KalmanTracker.h:15
KalmanTracker::KalmanTracker
KalmanTracker()
Definition KalmanTracker.h:21
KalmanTracker::predict
StateType predict()
Definition KalmanTracker.cpp:53
KalmanTracker::m_hit_streak
int m_hit_streak
Definition KalmanTracker.h:54
KalmanTracker::m_hits
int m_hits
Definition KalmanTracker.h:53
KalmanTracker::confidence
float confidence
Definition KalmanTracker.h:57
KalmanTracker::~KalmanTracker
~KalmanTracker()
Definition KalmanTracker.h:40
KalmanTracker::KalmanTracker
KalmanTracker(StateType initRect, float confidence, int classId, int objectId)
Definition KalmanTracker.h:30
KalmanTracker::m_id
int m_id
Definition KalmanTracker.h:56
KalmanTracker::m_age
int m_age
Definition KalmanTracker.h:55
KalmanTracker::get_state
StateType get_state()
Definition KalmanTracker.cpp:103
KalmanTracker::update
void update(StateType stateMat)
Definition KalmanTracker.cpp:80
KalmanTracker::m_time_since_update
int m_time_since_update
Definition KalmanTracker.h:52
KalmanTracker::classId
int classId
Definition KalmanTracker.h:58
KalmanTracker::predict2
StateType predict2()
Definition KalmanTracker.cpp:69
KalmanTracker::get_rect_xysr
StateType get_rect_xysr(float cx, float cy, float s, float r)
Definition KalmanTracker.cpp:110