diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-16 15:41:06 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-16 15:41:06 +0200 |
commit | 9d2dd118a497f6744c34331333bc3c4c61123eed (patch) | |
tree | 5d620c7d07950bdb922e70543105e5f069e99c4f | |
parent | 7900281e56efcd88a538905ac434da530a231d4b (diff) |
tracker/aruco: appease bounds check in libaruco
libaruco doesn't clamp the min/max sizes but throws an exception.
Reported-by: @duamutefmc
Data-by: @Emton
Issue: #329
Closes #329
-rw-r--r-- | tracker-aruco/ftnoir_tracker_aruco.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index 294552ea..365cca5d 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -179,8 +179,8 @@ void Tracker::run() if (last_roi.width > 0 && last_roi.height) { - detector.setMinMaxSize(std::max(0.01, size_min * grayscale.cols / last_roi.width), - std::min(1.0, size_max * grayscale.cols / last_roi.width)); + detector.setMinMaxSize(std::min(1., std::max(0.01, size_min * grayscale.cols / last_roi.width)), + std::max(0.01, std::min(1.0, size_max * grayscale.cols / last_roi.width))); cv::Mat grayscale_ = grayscale(last_roi).clone(); if (detector.detect(grayscale_, markers, cv::Mat(), cv::Mat(), -1, false), |