From 8ca38ae2a9dc59ab61cb17ee5c550fd36f1fd050 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 6 Dec 2018 08:08:15 +0100 Subject: tracker/pt: try cache pixels slightly below `thres' The logic is that each point has a halo around it. Catching the entire halo will allow to have more stable centers. Larger points are more stable as well. --- tracker-pt/module/point_extractor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tracker-pt/module') diff --git a/tracker-pt/module/point_extractor.cpp b/tracker-pt/module/point_extractor.cpp index fcf58c2d..f8c37351 100644 --- a/tracker-pt/module/point_extractor.cpp +++ b/tracker-pt/module/point_extractor.cpp @@ -190,7 +190,8 @@ void PointExtractor::threshold_image(const cv::Mat& frame_gray, cv::Mat1b& outpu float const* const __restrict ptr = hist.ptr(0); const unsigned area = uround(3 * M_PI * radius*radius); const unsigned sz = unsigned(hist.cols * hist.rows); - unsigned thres = 32; + constexpr unsigned min_thres = 64; + unsigned thres = min_thres; for (unsigned i = sz-1, cnt = 0; i > 32; i--) { cnt += ptr[i]; @@ -199,6 +200,9 @@ void PointExtractor::threshold_image(const cv::Mat& frame_gray, cv::Mat1b& outpu thres = i; } + if (thres > min_thres) + thres *= .8; + cv::threshold(frame_gray, output, thres, 255, cv::THRESH_BINARY); } } -- cgit v1.2.3