From fc2238f7b09ff20c130314acbd93ecfa745faa8e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 14 May 2018 17:23:20 +0200 Subject: tracker/aruco: remove some obsolete stuff --- tracker-aruco/aruco-trackercontrols.ui | 115 ++++++++++++++------------------- tracker-aruco/ftnoir_tracker_aruco.cpp | 34 ++-------- tracker-aruco/ftnoir_tracker_aruco.h | 50 +++++--------- 3 files changed, 73 insertions(+), 126 deletions(-) diff --git a/tracker-aruco/aruco-trackercontrols.ui b/tracker-aruco/aruco-trackercontrols.ui index 0d70d9ed..a1600a8f 100644 --- a/tracker-aruco/aruco-trackercontrols.ui +++ b/tracker-aruco/aruco-trackercontrols.ui @@ -9,8 +9,8 @@ 0 0 - 453 - 246 + 462 + 221 @@ -64,21 +64,33 @@ - - - - Diagonal FOV + + + + + 0 + 0 + - - + + 0 0 + + + + + 35 + + + 90 + @@ -106,6 +118,34 @@ + + + + Frames per second + + + + + + + Resolution + + + + + + + Camera name + + + + + + + Diagonal FOV + + + @@ -146,47 +186,7 @@ - - - - - 0 - 0 - - - - - - - 35 - - - 90 - - - - - - - Camera name - - - - - - - Frames per second - - - - - - - Resolution - - - - + @@ -199,23 +199,6 @@ - - - - Model rotation - - - - - - - - 0 - 0 - - - - diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index faa8bb44..5ce52565 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -227,19 +227,6 @@ void aruco_tracker::clamp_last_roi() last_roi &= cv::Rect(0, 0, color.cols, color.rows); } -cv::Point3f aruco_tracker::rotate_model(float x, float y, settings::rot mode) -{ - cv::Point3f pt(x, y, 0); - - if (mode) - { - const double theta = int(mode) * 90/4. * M_PI/180; - pt.x = x * cos(theta) - y * sin(theta); - pt.y = y * cos(theta) + x * sin(theta); - } - return pt; -} - void aruco_tracker::set_points() { using f = float; @@ -249,12 +236,10 @@ void aruco_tracker::set_points() const int x1=1, x2=2, x3=3, x4=0; - settings::rot mode = s.model_rotation; - - obj_points[x1] = rotate_model(-size, -size, mode); - obj_points[x2] = rotate_model(size, -size, mode); - obj_points[x3] = rotate_model(size, size, mode); - obj_points[x4] = rotate_model(-size, size, mode); + obj_points[x1] = { -size, -size, 0 }; + obj_points[x2] = { size, -size, 0 }; + obj_points[x3] = { size, size, 0 }; + obj_points[x4] = { -size, size, 0 }; for (unsigned i = 0; i < 4; i++) obj_points[i] += cv::Point3f(hx, hy, hz); @@ -341,9 +326,9 @@ void aruco_tracker::set_detector_params() detector.setThresholdParams(adaptive_sizes[adaptive_size_pos], adaptive_thres); #else - detector._thresMethod = aruco::MarkerDetector::CANNY; - int value = adaptive_sizes[adaptive_size_pos]; - detector.setThresholdParams(value, value * 3); + detector._thresMethod = aruco::MarkerDetector::CANNY; + int value = adaptive_sizes[adaptive_size_pos]; + detector.setThresholdParams(value, value * 3); #endif } @@ -480,11 +465,6 @@ aruco_dialog::aruco_dialog() : tie_setting(s.headpos_y, ui.cy); tie_setting(s.headpos_z, ui.cz); - ui.model_rotation->addItem("0", int(settings::rot_zero)); - ui.model_rotation->addItem("+22.5", int(settings::rot_plus)); - ui.model_rotation->addItem("-22.5", int(settings::rot_neg)); - tie_setting(s.model_rotation, ui.model_rotation); - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); connect(ui.btn_calibrate, SIGNAL(clicked()), this, SLOT(toggleCalibrate())); diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h index 293991eb..b634576a 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.h +++ b/tracker-aruco/ftnoir_tracker_aruco.h @@ -38,29 +38,17 @@ using namespace options; struct settings : opts { - enum rot - { - rot_zero = 0, - rot_neg = -1, - rot_plus = +1, - }; - - value fov; - value headpos_x, headpos_y, headpos_z; - value camera_name; - value force_fps, resolution; - value model_rotation; - settings() : - opts("aruco-tracker"), - fov(b, "field-of-view", 56), - headpos_x(b, "headpos-x", 0), - headpos_y(b, "headpos-y", 0), - headpos_z(b, "headpos-z", 0), - camera_name(b, "camera-name", ""), - force_fps(b, "force-fps", 0), - resolution(b, "force-resolution", 0), - model_rotation(b, "model-rotation", rot_zero) - {} + value camera_name { b, "camera-name", ""}; + value fov { b, "field-of-view", 56 }; + + value headpos_x { b, "headpos-x", 0 }, + headpos_y { b, "headpos-y", 0 }, + headpos_z { b, "headpos-z", 0 }; + + value force_fps { b, "force-fps", 0 }, + resolution { b, "force-resolution", 0 }; + + settings() = default; }; class aruco_dialog; @@ -93,8 +81,6 @@ private: 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; QMutex mtx; @@ -105,9 +91,6 @@ private: double no_detection_timeout = 0; cv::Mat frame, grayscale, color; cv::Matx33d r; -#ifdef DEBUG_UNSHARP_MASKING - cv::Mat blurred; -#endif std::vector obj_points {4}; cv::Matx33d intrinsics = cv::Matx33d::eye(); aruco::MarkerDetector detector; @@ -121,7 +104,7 @@ private: std::vector roi_points {4}; cv::Rect last_roi { 65535, 65535, 0, 0 }; Timer fps_timer, last_detection_timer; - unsigned adaptive_size_pos = 0; + unsigned adaptive_size_pos { 0 }; bool use_otsu = false; #if !defined USE_EXPERIMENTAL_CANNY @@ -130,10 +113,6 @@ private: static constexpr inline int adaptive_thres = 3; #endif -#ifdef DEBUG_UNSHARP_MASKING - static constexpr inline double gauss_kernel_size = 3; -#endif - static constexpr inline double timeout = 1; static constexpr inline double timeout_backoff_c = 4./11; @@ -141,6 +120,11 @@ private: static constexpr inline float size_max = 0.5; static constexpr inline double RC = .25; + +#ifdef DEBUG_UNSHARP_MASKING + static constexpr inline double gauss_kernel_size = 3; + cv::Mat blurred; +#endif }; class aruco_dialog : public ITrackerDialog -- cgit v1.2.3