summaryrefslogtreecommitdiffhomepage
path: root/tracker-aruco
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-12-03 07:12:20 +0100
committerStanislaw Halik <sthalik@misaki.pl>2016-12-03 07:12:20 +0100
commit7c5784780fd9c5d9fe0bf5cb3fb2ac2bf6dd0ae0 (patch)
tree1d15a1feaf398d7b2ab314c3f1071d1d08dcd5cc /tracker-aruco
parentd9df8ee0ab28c5ac46c8026dcaff135356ca6953 (diff)
tracker/aruco: simplify open-coded clamp()
Diffstat (limited to 'tracker-aruco')
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.cpp8
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp
index 5473eb6f..02b1f830 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.cpp
+++ b/tracker-aruco/ftnoir_tracker_aruco.cpp
@@ -38,8 +38,8 @@ static constexpr const resolution_tuple resolution_choices[] =
};
constexpr const double aruco_tracker::RC;
-constexpr const double aruco_tracker::size_min;
-constexpr const double aruco_tracker::size_max;
+constexpr const float aruco_tracker::size_min;
+constexpr const float aruco_tracker::size_max;
aruco_tracker::aruco_tracker() :
fps(0),
@@ -91,8 +91,8 @@ bool aruco_tracker::detect_with_roi()
{
if (last_roi.width > 1 && last_roi.height > 1)
{
- detector.setMinMaxSize(std::min(1., std::max(.01, size_min * grayscale.cols / last_roi.width)),
- std::max(.01, std::min(1., size_max * grayscale.cols / last_roi.width)));
+ detector.setMinMaxSize(clamp(size_min * grayscale.cols / last_roi.width, .01f, 1.f),
+ clamp(size_max * grayscale.cols / last_roi.width, .01f, 1.f));
detector.detect(grayscale(last_roi), markers, cv::Mat(), cv::Mat(), -1, false);
diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h
index edec2437..cdea1e42 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.h
+++ b/tracker-aruco/ftnoir_tracker_aruco.h
@@ -100,8 +100,8 @@ private:
volatile bool stop;
- static constexpr const double size_min = 0.05f;
- static constexpr const double size_max = 0.3f;
+ static constexpr const float size_min = 0.05;
+ static constexpr const float size_max = 0.3;
static constexpr const double RC = .25;
};