Add callback from multitracker to engine
[trackerpp.git] / include / Tracker.h
1 #ifndef _TRACKER_H_
2 #define _TRACKER_H_
3
4 #include <opencv2/opencv.hpp>
5 #include <string>
6 #include <vector>
7 #include "Metrics.h"
8 #include "SharedPtr.h"
9 #include "MultiTracker.h"
10 #include "Detector.h"
11
12 namespace suanzi {
13
14     TK_DECLARE_PTR(Tracker);
15     TK_DECLARE_PTR(Patch);
16     typedef enum 
17     {
18         Fire = -1,
19         Active = 2,
20         Lost,
21         Delete
22     } TrackerStatus;
23
24     class Tracker
25     {
26     public:
27         Tracker(const cv::Mat& image, const Detection& d, int id = 0);
28         virtual ~Tracker();
29         void updateState(const cv::Mat& image);
30         void addPatch(PatchPtr p);
31         void correct(const cv::Mat& image, const Detection& d);
32         TrackerStatus status;
33         std::vector<PatchPtr> patches;
34         Detection detection;
35
36     private:
37         TrackerStatus preStatus;
38         int id;
39         int age;
40         int last_active;
41         cv::KalmanFilter kf = {4,2};
42     };
43
44
45 }
46
47 #endif /* _TRACKER_H_ */