diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-07 05:50:42 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-07 05:57:32 +0200 |
commit | b68cf0b79cf112d919ee0f224bc205f57c7cac92 (patch) | |
tree | 466d468ff03d6ff59d99ad532c648c7fe7a67f58 /ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | |
parent | 9e58eb6d5eebb3ca67bf4dba6b7fef58588d492e (diff) |
aruco: try otsu for one frame if regular fails
Diffstat (limited to 'ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp')
-rwxr-xr-x[-rw-r--r--] | ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index a6889f82..84f20a61 100644..100755 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -134,6 +134,7 @@ void Tracker::run() cv::Vec3d rvec, tvec; cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); cv::Mat dist_coeffs = cv::Mat::zeros(5, 1, CV_32FC1); + bool otsu = false; while (!stop) { @@ -182,7 +183,8 @@ void Tracker::run() detector.setMinMaxSize(std::max(0.01, size_min * grayscale.cols / last_roi.width), std::min(1.0, size_max * grayscale.cols / last_roi.width)); - if (detector.detect(grayscale(last_roi), markers, cv::Mat(), cv::Mat(), -1, false), + cv::Mat grayscale_ = grayscale(last_roi).clone(); + if (detector.detect(grayscale_, markers, cv::Mat(), cv::Mat(), -1, false), markers.size() == 1 && markers[0].size() == 4) { failed = std::max(0., failed - dt); @@ -199,6 +201,8 @@ void Tracker::run() if (!roi_valid) { + otsu = !otsu; + detector._thresMethod = otsu ? aruco::MarkerDetector::FIXED_THRES : aruco::MarkerDetector::ADPT_THRES; failed += dt; if (failed > max_failed) { |