summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-06-21 11:11:11 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-06-21 11:11:11 +0200
commitf434ba5aa24870582059725e72f5595c839ad3e0 (patch)
treeea3663949c8ea82a19648616da53ddded374d007
parentcf09ec936348f1d59473cb50b35fe80addacfc44 (diff)
tracker/pt: adjust auto threshold max area size
-rw-r--r--tracker-pt/point_extractor.cpp11
-rw-r--r--tracker-pt/point_extractor.h2
2 files changed, 6 insertions, 7 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp
index e27bd3c7..fb547ef6 100644
--- a/tracker-pt/point_extractor.cpp
+++ b/tracker-pt/point_extractor.cpp
@@ -59,7 +59,7 @@ const std::vector<cv::Vec2f>& PointExtractor::extract_points(cv::Mat& frame)
const int sz = hist.cols * hist.rows;
int val = 0;
int cnt = 0;
- constexpr int min_pixels = 400;
+ constexpr int min_pixels = int(10 * 10 * 3 * pi);
const int pixels_to_include = std::max<int>(0, min_pixels * s.threshold / 255);
auto ptr = reinterpret_cast<const float*>(hist.ptr(0));
for (int i = sz-1; i >= 0; i--)
@@ -132,22 +132,21 @@ const std::vector<cv::Vec2f>& PointExtractor::extract_points(cv::Mat& frame)
}
blobs.push_back(blob(radius, pos, confid));
-
+
if (blobs.size() == max_blobs)
break;
}
-
+
using b = const blob;
std::sort(blobs.begin(), blobs.end(), [](b& b1, b& b2) {return b1.confid > b2.confid;});
-
+
QMutexLocker l(&mtx);
points.clear();
-
+
for (auto& b : blobs)
{
cv::Vec2f p((b.pos[0] - W/2)/W, -(b.pos[1] - H/2)/W);
points.push_back(p);
}
-
return points;
}
diff --git a/tracker-pt/point_extractor.h b/tracker-pt/point_extractor.h
index b3fac38a..94948d34 100644
--- a/tracker-pt/point_extractor.h
+++ b/tracker-pt/point_extractor.h
@@ -25,7 +25,7 @@ public:
const std::vector<cv::Vec2f> &extract_points(cv::Mat &frame);
int get_n_points() { QMutexLocker l(&mtx); return points.size(); }
PointExtractor();
-
+
settings_pt s;
private:
static constexpr double pi = 3.14159265359;