From a7934cb10a18a82ce0c16c98d9592333c439fdac Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 26 Sep 2018 09:26:47 +0200 Subject: [PATCH] Simplify scale initialization --- src/kcf.cpp | 7 ++----- src/kcf.h | 4 +++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/kcf.cpp b/src/kcf.cpp index 576fae8..eb8d4c0 100644 --- a/src/kcf.cpp +++ b/src/kcf.cpp @@ -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) { diff --git a/src/kcf.h b/src/kcf.h index 88798d1..14723a1 100644 --- 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 p_scales; + const int p_num_of_feats = 31 + (m_use_color ? 3 : 0) + (m_use_cnfeat ? 10 : 0); cv::Size p_roi; -- 2.39.2