07bd5db616117bb81ccba97c22abcf1c87057994
[trackerpp.git] / include / MultiTracker.h
1 #ifndef _MULTI_TRACKER_H_
2 #define _MULTI_TRACKER_H_
3
4 #include "Tracker.h"
5 #include "Detector.h"
6 #include "SharedPtr.h"
7 #include "PredictorWrapper.h"
8 #include <opencv2/opencv.hpp>
9 #include <utility>
10 #include "Engine.h"
11
12 namespace suanzi {
13
14     TK_DECLARE_PTR(Patch);
15     TK_DECLARE_PTR(MultiTracker);
16     TK_DECLARE_PTR(Tracker);
17     TK_DECLARE_PTR(Engine);
18
19     class MultiTracker 
20     {
21     public:
22         MultiTracker(EngineWPtr e);
23         virtual ~MultiTracker();
24         void update(unsigned int total, const Detection* d, const cv::Mat& image);
25
26     private:
27         std::vector<TrackerPtr> trackers;
28         int max_id = 0;
29         PatchPtr createPatch(const cv::Mat& image, const Detection& d);
30         double distance(TrackerPtr t, const cv::Mat& image, const Detection& d);
31         PredictorWrapperPtr predictor;
32         cv::HOGDescriptor descriptor;
33         EngineWPtr engine;
34     };
35
36     class Patch
37     {
38     public:
39         ~Patch(){};
40         cv::Mat image_crop;
41         // hog is a hog descriptor of the image (calculated by hog.compute. size is 3780 )
42         // hue is a histogram of the image, (calcHist(), is a Mat with (width x height) 64 x 45)
43         std::pair<std::vector<double>, cv::Mat> features;
44         Detection detection;
45     protected:
46         friend class MultiTracker;
47         Patch(){};
48     };
49
50
51 }
52
53 #endif /* _MULTI_TRACKER_H_ */