summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/module/point_extractor.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-01-03 00:09:09 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-01-16 07:48:20 +0100
commit545071e998806235442edda5f575ee61e836abe9 (patch)
tree45579d717361f24c6f4a06354f5836447e691771 /tracker-pt/module/point_extractor.cpp
parent4766be01022d6de50f7b42647299860c2d9909b8 (diff)
cruft
Diffstat (limited to 'tracker-pt/module/point_extractor.cpp')
-rw-r--r--tracker-pt/module/point_extractor.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tracker-pt/module/point_extractor.cpp b/tracker-pt/module/point_extractor.cpp
index e6364a88..0f7af939 100644
--- a/tracker-pt/module/point_extractor.cpp
+++ b/tracker-pt/module/point_extractor.cpp
@@ -182,20 +182,20 @@ void PointExtractor::threshold_image(const cv::Mat& frame_gray, cv::Mat1b& outpu
const f radius = (f) threshold_radius_value(frame_gray.cols, frame_gray.rows, threshold_slider_value);
float const* const __restrict ptr = hist.ptr<float>(0);
- const unsigned area = uround(3 * M_PI * radius*radius);
+ const unsigned area = uround(3 * pi * radius*radius);
const unsigned sz = unsigned(hist.cols * hist.rows);
constexpr unsigned min_thres = 64;
unsigned thres = min_thres;
for (unsigned i = sz-1, cnt = 0; i > 32; i--)
{
- cnt += ptr[i];
+ cnt += (unsigned)ptr[i];
if (cnt >= area)
break;
thres = i;
}
if (thres > min_thres)
- thres *= .8;
+ thres = uround(thres * .8);
cv::threshold(frame_gray, output, thres, 255, cv::THRESH_BINARY);
}
@@ -263,12 +263,12 @@ void PointExtractor::extract_points(const pt_frame& frame_, pt_preview& preview_
}
}
- const double radius = std::sqrt(cnt / M_PI);
+ const double radius = std::sqrt(cnt / pi);
if (radius > region_size_max || radius < region_size_min)
continue;
blobs.emplace_back(radius,
- vec2(rect.width/2., rect.height/2.),
+ vec2(rect.width/f(2), rect.height/f(2)),
std::pow(f(norm), f(1.1))/cnt,
rect);
@@ -294,7 +294,7 @@ end:
for (idx = 0; idx < sz; ++idx)
{
- blob &b = blobs[idx];
+ blob& b = blobs[idx];
cv::Rect rect = b.rect;
rect.x -= rect.width / 2;