From 67145ae776064fe57b7a25573909190e4a6d6ac8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 31 Dec 2016 07:06:59 +0100 Subject: tracker/aruco: cycle threshold params if detection fails --- tracker-aruco/ftnoir_tracker_aruco.h | 39 +++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'tracker-aruco/ftnoir_tracker_aruco.h') diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h index aa3c59f7..6e7db3f6 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.h +++ b/tracker-aruco/ftnoir_tracker_aruco.h @@ -28,6 +28,7 @@ #include #include + using namespace options; struct settings : opts { @@ -83,6 +84,10 @@ private: void set_last_roi(); void set_rmat(); void set_roi_from_projection(); + void set_detector_params(); + void cycle_detection_params(); + + cv::Point3f rotate_model(float x, float y, settings::rot mode); cv::VideoCapture camera; QMutex camera_mtx; @@ -90,7 +95,7 @@ private: qshared videoWidget; qshared layout; settings s; - double pose[6], fps; + double pose[6], fps, no_detection_timeout; cv::Mat frame, grayscale, color; cv::Matx33d r; std::vector obj_points; @@ -105,9 +110,37 @@ private: cv::Vec3d euler; std::vector roi_points; cv::Rect last_roi; - Timer fps_timer; - + Timer fps_timer, last_detection_timer; + unsigned adaptive_size_pos; volatile bool stop; + bool use_otsu; + + struct resolution_tuple + { + int width; + int height; + }; + + static constexpr const int adaptive_sizes[] = + { + 7, + 9, + //11, + 13, + //5, + }; + + static constexpr int adaptive_thres = 6; + + static constexpr const resolution_tuple resolution_choices[] = + { + { 640, 480 }, + { 320, 240 }, + { 0, 0 } + }; + + static constexpr double timeout = 1; + static constexpr double timeout_backoff_c = 4./11; static constexpr const float size_min = 0.05; static constexpr const float size_max = 0.3; -- cgit v1.2.3