From e824352d75e830de81a6cd893f3f3edc317c2dc2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 20 Jul 2016 08:21:00 +0200 Subject: tracker/pt: change brightness formula Use square root of area. Otherwise very small bright points are unfairly used. --- tracker-pt/point_extractor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tracker-pt') diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index 9b1a5e87..e3a6b04a 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -132,18 +132,18 @@ void PointExtractor::extract_points(cv::Mat& frame, std::vector 0) { - const double radius = std::sqrt(cnt / pi); + const double radius = sqrt(cnt / pi); if (radius > region_size_max || radius < region_size_min) continue; const double norm = double(m00); - blob b(radius, cv::Vec2d(m10 / norm, m01 / norm), vals/(double)cnt); + blob b(radius, cv::Vec2d(m10 / norm, m01 / norm), vals/sqrt(double(cnt))); blobs.push_back(b); { char buf[64]; sprintf(buf, "%.2fpx", radius); cv::putText(frame, buf, - cv::Point((int)std::round(b.pos[0]+30), (int)std::round(b.pos[1]+20)), + cv::Point((int)round(b.pos[0]+30), (int)round(b.pos[1]+20)), cv::FONT_HERSHEY_DUPLEX, 1, cv::Scalar(0, 0, 255), @@ -153,7 +153,7 @@ void PointExtractor::extract_points(cv::Mat& frame, std::vector bool { return b2.brightness < b1.brightness; }); + sort(blobs.begin(), blobs.end(), [](const blob& b1, const blob& b2) -> bool { return b2.brightness < b1.brightness; }); points.reserve(max_blobs); points.clear(); -- cgit v1.2.3