From c3fb017d459a5afad2f3b7f15038cea28e1cfd89 Mon Sep 17 00:00:00 2001 From: "Kellerman, Raizy" Date: Mon, 5 Jun 2017 14:58:37 +0300 Subject: [PATCH] Fixing misalignment crash: width and height of bbox should be a multiple of (cell_size * 2) --- src/kcf.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kcf.cpp b/src/kcf.cpp index 0e358a9c..58fc6f5c 100644 --- a/src/kcf.cpp +++ b/src/kcf.cpp @@ -57,8 +57,8 @@ void KCF_Tracker::init(cv::Mat &img, const cv::Rect & bbox) } //compute win size + fit to fhog cell size - p_windows_size[0] = round(p_pose.w * (1. + p_padding) / p_cell_size) * p_cell_size; - p_windows_size[1] = round(p_pose.h * (1. + p_padding) / p_cell_size) * p_cell_size; + p_windows_size[0] = ceil(p_pose.w * (1. + p_padding) / (float)(p_cell_size*2)) * p_cell_size * 2; + p_windows_size[1] = ceil(p_pose.h * (1. + p_padding) / (float)(p_cell_size*2)) * p_cell_size * 2; p_scales.clear(); if (m_use_scale) @@ -659,4 +659,4 @@ double KCF_Tracker::sub_grid_scale(std::vector & responses, int index) if (a > 0 || a < 0) scale = -b / (2 * a); return scale; -} \ No newline at end of file +}