summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/point_extractor.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-10-13 18:53:28 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-10-13 18:53:28 +0200
commit9da6dff1800d6b6598e6ad04465ee8b9cabb4167 (patch)
tree2f1692597748ce37d2ce147e8ed9f0c7d71d00e9 /tracker-pt/point_extractor.cpp
parent535e81402a65fa410e98899cd1780784d2f9815a (diff)
tracker/pt, options: fix threshold slider
It's only the tie_setting(slider_value, QSlider) that has race-free slider updates. Needed to update the threshold slider representation. Remove the tie_setting(int, QSlider) overload since it doesn't have the logic. Add a migration. Add base_value::notify() for use-cases like the checkbox updating the label.
Diffstat (limited to 'tracker-pt/point_extractor.cpp')
-rw-r--r--tracker-pt/point_extractor.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp
index adb23d52..40054084 100644
--- a/tracker-pt/point_extractor.cpp
+++ b/tracker-pt/point_extractor.cpp
@@ -180,10 +180,11 @@ void PointExtractor::extract_points(const cv::Mat& frame, cv::Mat& preview_frame
const double region_size_min = s.min_point_size;
const double region_size_max = s.max_point_size;
+ const int threshold_slider_value = s.threshold_slider.to<int>();
+
if (!s.auto_threshold)
{
- const int thres = s.threshold;
- cv::threshold(frame_gray, frame_bin, thres, 255, cv::THRESH_BINARY);
+ cv::threshold(frame_gray, frame_bin, threshold_slider_value, 255, cv::THRESH_BINARY);
}
else
{
@@ -200,7 +201,7 @@ void PointExtractor::extract_points(const cv::Mat& frame, cv::Mat& preview_frame
(int const*) &hist_size,
&ranges);
- const double radius = threshold_radius_value(frame.cols, frame.rows, s.threshold);
+ const double radius = threshold_radius_value(frame.cols, frame.rows, threshold_slider_value);
float const* restrict_ptr ptr = reinterpret_cast<float const* restrict_ptr>(hist.ptr(0));
const unsigned area = uround(3 * M_PI * radius*radius);