summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-12-28 05:51:25 +0100
committerStanislaw Halik <sthalik@misaki.pl>2013-12-28 05:51:25 +0100
commit8d541f45950cb59fe3463bba3cae0024bb466a31 (patch)
treeed08e800d0467bdad3cd04cbe2b6e2a67870c8f1 /ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
parentd65cf74ce47e66dba1c58212e1aadce07a6ca5cf (diff)
don't hardcode min/max size constants
Diffstat (limited to 'ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp')
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
index 999431a0..09ab4f29 100644
--- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
+++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
@@ -282,12 +282,15 @@ void Tracker::run()
std::vector< aruco::Marker > markers;
+ const double size_min = 0.08;
+ const double size_max = 0.39;
+
if (last_roi.width > 0 &&
(detector.detect(grayscale(last_roi), markers, cv::Mat(), cv::Mat(), -1, false),
markers.size() == 1 && markers[0].size() == 4))
{
- detector.setMinMaxSize(std::max(0.1, 0.08 * grayscale.cols / last_roi.width),
- std::min(1.0, 0.39 * grayscale.cols / last_roi.width));
+ detector.setMinMaxSize(std::max(0.01, size_min * grayscale.cols / last_roi.width),
+ std::min(1.0, size_max * grayscale.cols / last_roi.width));
auto& m = markers.at(0);
for (int i = 0; i < 4; i++)
{
@@ -298,7 +301,7 @@ void Tracker::run()
}
else
{
- detector.setMinMaxSize(0.08, 0.39);
+ detector.setMinMaxSize(size_min, size_max);
detector.detect(grayscale, markers, cv::Mat(), cv::Mat(), -1, false);
}