OpenShot Library | libopenshot 0.3.3
Loading...
Searching...
No Matches
KalmanTracker.h
Go to the documentation of this file.
1// © OpenShot Studios, LLC
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
6// KalmanTracker.h: KalmanTracker Class Declaration
7
8#ifndef KALMAN_H
9#define KALMAN_H 2
10
11#include "opencv2/video/tracking.hpp"
12#include "opencv2/highgui/highgui.hpp"
13
14
15#define StateType cv::Rect_<float>
16
19{
20public:
22 {
23 init_kf(StateType());
25 m_hits = 0;
26 m_hit_streak = 0;
27 m_age = 0;
28 m_id = 0;
29 }
31 {
32 init_kf(initRect);
34 m_hits = 0;
35 m_hit_streak = 0;
36 m_age = 0;
37 m_id = objectId;
38 }
39
41 {
42 m_history.clear();
43 }
44
47 void update(StateType stateMat);
48
50 StateType get_rect_xysr(float cx, float cy, float s, float r);
51
53 int m_hits;
55 int m_age;
56 int m_id;
59
60private:
61 void init_kf(StateType stateMat);
62
63 cv::KalmanFilter kf;
64 cv::Mat measurement;
65
66 std::vector<StateType> m_history;
67};
68
69#endif
#define StateType
This class represents the internel state of individual tracked objects observed as bounding box.
StateType predict()
KalmanTracker(StateType initRect, float confidence, int classId, int objectId)
StateType get_state()
void update(StateType stateMat)
StateType predict2()
StateType get_rect_xysr(float cx, float cy, float s, float r)