X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hercules2020/kcf.git/blobdiff_plain/fe1f105e94b12100d225e50354e1bd054fa7cf61..9ebe36c3294847c12e74583762247a36038b91c2:/src/kcf.cpp diff --git a/src/kcf.cpp b/src/kcf.cpp index 6668925..64baea7 100644 --- a/src/kcf.cpp +++ b/src/kcf.cpp @@ -369,6 +369,7 @@ double KCF_Tracker::findMaxReponse(uint &max_idx, cv::Point2d &new_location) con tmp /= max; // Normalize to 1 cross += cv::Point2d(tmp.size())/2; tmp = circshift(tmp, -tmp.cols/2, -tmp.rows/2); + //drawCross(tmp, cross, false); } bool green = false; if (&*max_it == &IF_BIG_BATCH(threadctx.max(i, j), threadctx)) { @@ -376,9 +377,10 @@ double KCF_Tracker::findMaxReponse(uint &max_idx, cv::Point2d &new_location) con cross = new_location + cv::Point2d(tmp.size())/2; green = true; } - cross.x *= double(w)/tmp.cols; - cross.y *= double(h)/tmp.rows; - cv::resize(tmp, tmp, cv::Size(w, h)); + // Move to the center of pixes (if scaling up) and scale + cross.x = (cross.x + 0.5) * double(w)/tmp.cols; + cross.y = (cross.y + 0.5) * double(h)/tmp.rows; + cv::resize(tmp, tmp, cv::Size(w, h)); //, 0, 0, cv::INTER_NEAREST); drawCross(tmp, cross, green); cv::Mat resp_roi(all_responses, cv::Rect(j * (w+1), i * (h+1), w, h)); tmp.copyTo(resp_roi);