summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-16 23:49:48 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-16 23:54:31 +0200
commit1938853fd7b5889f0381a6ad120f877b649d4887 (patch)
tree96be852a1b9c86ef3554a8efc4fa6dd214e43e53
parentc031551efd47e56384c46342df8a5b2030f19fb4 (diff)
tracker/pt: don't scale down auto threshold value
Also, make the slider signify the max point radius (hence squaring).
-rw-r--r--tracker-pt/point_extractor.cpp7
-rw-r--r--tracker-pt/point_extractor.h2
2 files changed, 4 insertions, 5 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp
index f52ab424..e3472391 100644
--- a/tracker-pt/point_extractor.cpp
+++ b/tracker-pt/point_extractor.cpp
@@ -1,5 +1,5 @@
/* Copyright (c) 2012 Patrick Ruoff
- * Copyright (c) 2014-2015 Stanislaw Halik <sthalik@misaki.pl>
+ * Copyright (c) 2015-2016 Stanislaw Halik <sthalik@misaki.pl>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -62,7 +62,7 @@ const std::vector<vec2>& PointExtractor::extract_points(cv::Mat& frame)
int val = 0;
int cnt = 0;
constexpr int min_pixels = int(10 * 10 * 3 * pi);
- const int pixels_to_include = std::max<int>(0, min_pixels * s.threshold / 255);
+ const int pixels_to_include = std::max<int>(0, min_pixels * s.threshold * s.threshold / (256 * 256));
auto ptr = reinterpret_cast<const float*>(hist.ptr(0));
for (int i = sz-1; i >= 0; i--)
{
@@ -73,8 +73,7 @@ const std::vector<vec2>& PointExtractor::extract_points(cv::Mat& frame)
break;
}
}
- val *= hist_c;
- val *= 240./256.;
+ //val *= 240./256.;
//qDebug() << "val" << val;
cv::threshold(frame_gray, frame_bin, val, 255, CV_THRESH_BINARY);
diff --git a/tracker-pt/point_extractor.h b/tracker-pt/point_extractor.h
index 67b2b8ea..52b4cb32 100644
--- a/tracker-pt/point_extractor.h
+++ b/tracker-pt/point_extractor.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2012 Patrick Ruoff
+ * Copyright (c) 2015-2016 Stanislaw Halik <sthalik@misaki.pl>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -29,7 +30,6 @@ public:
settings_pt s;
private:
static constexpr double pi = 3.14159265359;
- static constexpr int hist_c = 1;
std::vector<vec2> points;
QMutex mtx;