]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blobdiff - src/kcf.h
Do not allow creation of ComplexMat with unknown size
[hercules2020/kcf.git] / src / kcf.h
index cc735d768cd6733ad6e8fb2abf2095187f03f1ec..48eb18dcb101d1488803e3aec99d86cf968964b0 100644 (file)
--- a/src/kcf.h
+++ b/src/kcf.h
@@ -120,13 +120,20 @@ private:
 
     Kcf_Tracker_Private &d;
 
-    //model
-    ComplexMat p_yf;
-    ComplexMat p_model_alphaf;
-    ComplexMat p_model_alphaf_num;
-    ComplexMat p_model_alphaf_den;
-    ComplexMat p_model_xf;
-    ComplexMat p_xf;
+    class Model {
+        uint height, width, n_feats;
+    public:
+        ComplexMat yf {height, width, 1};
+        ComplexMat model_alphaf {height, width, n_feats};
+        ComplexMat model_alphaf_num {height, width, n_feats};
+        ComplexMat model_alphaf_den {height, width, n_feats};
+        ComplexMat model_xf {height, width, n_feats};
+        ComplexMat xf {height, width, n_feats};
+
+        Model(cv::Size freq_size, uint _n_feats) : height(freq_size.height), width(freq_size.width), n_feats(_n_feats) {}
+    };
+
+    std::unique_ptr<Model> model;
 
     class GaussianCorrelation {
       public:
@@ -146,6 +153,7 @@ private:
         MatScales k;
     };
 
+
     //helping functions
     void scale_track(ThreadCtx &vars, cv::Mat &input_rgb, cv::Mat &input_gray);
     cv::Mat get_subwindow(const cv::Mat &input, int cx, int cy, int size_x, int size_y) const;