summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-17 13:04:01 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-10-17 13:04:01 +0200
commitb27141f3a4e4756c8019dabbdbd49b5a7da09ef0 (patch)
tree53b66f0687558b3dbcf9d4f4cfe058190032f6cd
parentf0800fee0d40b7375d3c7e7b7a7a99314c5fb251 (diff)
pt: refactor auto threshold somewhat
-rw-r--r--ftnoir_tracker_pt/point_extractor.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp
index f9be259a..a1e61f28 100644
--- a/ftnoir_tracker_pt/point_extractor.cpp
+++ b/ftnoir_tracker_pt/point_extractor.cpp
@@ -76,8 +76,8 @@ std::vector<cv::Vec2f> PointExtractor::extract_points(cv::Mat& frame)
const int sz = hist.rows*hist.cols;
int val = 0;
int cnt = 0;
- constexpr int min_pixels = 2000;
- const int pixels_to_include = std::max(0, static_cast<int>(min_pixels * (1. - s.threshold / 100.)));
+ constexpr int min_pixels = 250;
+ const auto pixels_to_include = std::max<int>(0, min_pixels * s.threshold/100.);
for (int i = sz-1; i >= 0; i--)
{
cnt += hist.at<float>(i);
@@ -87,8 +87,8 @@ std::vector<cv::Vec2f> PointExtractor::extract_points(cv::Mat& frame)
break;
}
}
- val *= .95;
- //qDebug() << "cnt" << cnt << "val" << val;
+ val *= 240./256.;
+ //qDebug() << "val" << val;
cv::Mat frame_bin_;
cv::threshold(frame_gray, frame_bin_, val, 255, CV_THRESH_BINARY);