OpenShot Library | libopenshot  0.3.0
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 {
20 public:
22  {
23  init_kf(StateType());
25  m_hits = 0;
26  m_hit_streak = 0;
27  m_age = 0;
28  m_id = 0;
29  }
30  KalmanTracker(StateType initRect, float confidence, int classId, int objectId) : confidence(confidence), classId(classId)
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;
57  float confidence;
58  int classId;
59 
60 private:
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
StateType get_rect_xysr(float cx, float cy, float s, float r)
StateType predict2()
void update(StateType stateMat)
StateType predict()
#define StateType
Definition: KalmanTracker.h:15
StateType get_state()
KalmanTracker(StateType initRect, float confidence, int classId, int objectId)
Definition: KalmanTracker.h:30
int m_time_since_update
Definition: KalmanTracker.h:52
This class represents the internel state of individual tracked objects observed as bounding box...
Definition: KalmanTracker.h:18