upgrade opencv to 3.3.1, complete patch similarity
[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
11 namespace suanzi {
12
13     TK_DECLARE_PTR(Patch);
14     TK_DECLARE_PTR(MultiTracker);
15     TK_DECLARE_PTR(Tracker);
16
17     class MultiTracker 
18     {
19     public:
20         MultiTracker();
21         virtual ~MultiTracker();
22         void update(unsigned int total, const Detection* d, const cv::Mat& image);
23
24     private:
25         std::vector<TrackerPtr> trackers;
26         int max_id = 0;
27         PatchPtr createPatch(const cv::Mat& image, const Detection& d);
28         double distance(TrackerPtr t, const cv::Mat& image, const Detection& d);
29         PredictorWrapperPtr predictor;
30         cv::HOGDescriptor descriptor;
31     };
32
33     class Patch
34     {
35     public:
36         ~Patch(){};
37         cv::Mat image_crop;
38         //std::vector<double> features;
39         // hog is a hog descriptor of the image (calculated by hog.compute. size is 3780 )
40         // hue is a histogram of the image, (calcHist(), is a Mat with (width x height) 64 x 45)
41         std::pair<std::vector<double>, cv::Mat> features;
42         Detection detection;
43     protected:
44         friend class MultiTracker;
45         Patch(){};
46     };
47
48
49 }
50
51 #endif /* _MULTI_TRACKER_H_ */