summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-20 08:21:00 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-20 08:21:00 +0200
commite824352d75e830de81a6cd893f3f3edc317c2dc2 (patch)
treed23b2b281ec51af914210fe990a043e542c86220
parent4a1cacb608abb49f1f1e06cc7241400cd42524e8 (diff)
tracker/pt: change brightness formula
Use square root of area. Otherwise very small bright points are unfairly used.
-rw-r--r--tracker-pt/point_extractor.cpp8
1 files changed, 4 insertions, 4 deletions
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<PointExtractor::
}
if (m00 > 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<PointExtractor::
}
}
- std::sort(blobs.begin(), blobs.end(), [](const blob& b1, const blob& b2) -> 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();