]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blobdiff - src/threadctx.hpp
Move scale_track method from KCF to ThreadCtx
[hercules2020/kcf.git] / src / threadctx.hpp
index 85529ddf7e193e57cb3c8d0a80b57d6df8707632..1e9a3fb2ada972fa580c71d37df2aa70ac26e40c 100644 (file)
@@ -30,34 +30,27 @@ struct ThreadCtx {
 
     ThreadCtx(ThreadCtx &&) = default;
 
+    void track(const KCF_Tracker &kcf, cv::Mat &input_rgb, cv::Mat &input_gray);
 private:
     cv::Size roi;
     uint num_channels;
     uint num_of_scales;
     cv::Size freq_size = Fft::freq_size(roi);
 
-public:
-#ifdef ASYNC
-    std::future<void> async_res;
-#endif
 
     KCF_Tracker::GaussianCorrelation gaussian_correlation{roi, num_of_scales, num_channels};
 
-#if defined(CUFFT) || defined(FFTW) // TODO: Why this ifdef?
-    MatDynMem in_all{roi.height * int(num_of_scales), roi.width, CV_32F};
-#else
-    MatDynMem in_all{roi, CV_32F};
-#endif
-    MatDynMem fw_all{roi.height * int(num_channels), roi.width, CV_32F};
     MatDynMem ifft2_res{roi, CV_32FC(int(num_channels))};
-    MatDynMem response{roi, CV_32FC(int(num_of_scales))};
 
     ComplexMat zf{uint(freq_size.height), uint(freq_size.width), num_channels, num_of_scales};
     ComplexMat kzf{uint(freq_size.height), uint(freq_size.width), num_of_scales};
 
-    // Variables used during non big batch mode and in big batch mode with ThreadCtx in p_threadctxs in kcf  on zero index.
-    cv::Point2i max_loc;
-    double max_val, max_response;
+public:
+#ifdef ASYNC
+    std::future<void> async_res;
+#endif
+
+    MatDynMem response{roi, CV_32FC(int(num_of_scales))};
 
 #ifdef BIG_BATCH
     // Stores value of responses, location of maximal response and response maps for each scale
@@ -65,6 +58,8 @@ public:
     std::vector<cv::Point2i> max_locs = std::vector<cv::Point2i>(num_of_scales);
     std::vector<cv::Mat> response_maps = std::vector<cv::Mat>(num_of_scales);
 #else
+    cv::Point2i max_loc;
+    double max_val, max_response;
     const double scale;
 #endif
 };