]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/commitdiff
Simplify scale initialization
authorMichal Sojka <michal.sojka@cvut.cz>
Wed, 26 Sep 2018 07:26:47 +0000 (09:26 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Wed, 26 Sep 2018 07:26:47 +0000 (09:26 +0200)
src/kcf.cpp
src/kcf.h

index 576fae87ee9d3d48e6bf3b548c7f09ba1da06328..eb8d4c0a0c32007d2e3a4ab68b11b08803cb1bc2 100644 (file)
@@ -176,11 +176,8 @@ void KCF_Tracker::init(cv::Mat &img, const cv::Rect &bbox, int fit_size_x, int f
     p_roi.height = p_windows_size.height / p_cell_size;
 
     p_scales.clear();
-    if (m_use_scale)
-        for (int i = -int(p_num_scales) / 2; i <= int(p_num_scales) / 2; ++i)
-            p_scales.push_back(std::pow(p_scale_step, i));
-    else
-        p_scales.push_back(1.);
+    for (int i = -int(p_num_scales) / 2; i <= int(p_num_scales) / 2; ++i)
+        p_scales.push_back(std::pow(p_scale_step, i));
 
 #ifdef CUFFT
     if (p_roi.height * (p_roi.width / 2 + 1) > 1024) {
index 88798d1ec56e5b9b5c3d074e5a0d0025c401f29f..14723a1587fa0dfbf407c99c89cabe03d076212c 100644 (file)
--- a/src/kcf.h
+++ b/src/kcf.h
@@ -109,12 +109,14 @@ private:
     const double p_interp_factor = 0.02;  //def = 0.02, linear interpolation factor for adaptation
     const int p_cell_size = 4;            //4 for hog (= bin_size)
     cv::Size p_windows_size;
-    const uint p_num_scales {7};
+
+    const uint p_num_scales = m_use_scale ? 7 : 1;
     const double p_scale_step = 1.02;
     double p_current_scale = 1.;
     double p_min_max_scale[2];
     std::vector<double> p_scales;
 
+
     const int p_num_of_feats = 31 + (m_use_color ? 3 : 0) + (m_use_cnfeat ? 10 : 0);
     cv::Size p_roi;