summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/module
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-12-06 08:08:15 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-12-06 08:11:01 +0100
commit8ca38ae2a9dc59ab61cb17ee5c550fd36f1fd050 (patch)
tree229a1d5bae0c1b8413fbaf41983f76a29aa98951 /tracker-pt/module
parent3fd39cf892250545b4510065fe16e39d494faa44 (diff)
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.
Diffstat (limited to 'tracker-pt/module')
-rw-r--r--tracker-pt/module/point_extractor.cpp6
1 files changed, 5 insertions, 1 deletions
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<float>(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);
}
}