From 42f13fed362891c5ca8f4d6f7ed070cbd09dd846 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 5 Oct 2014 21:38:43 +0200 Subject: nix market pitch, aruco credit doesn't fit anymore sadly --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 249 +++++++++++--------------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 34 +--- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 4 +- 3 files changed, 117 insertions(+), 170 deletions(-) diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index e5654bd5..240ef5f8 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -9,8 +9,8 @@ 0 0 - 636 - 368 + 560 + 214 @@ -22,16 +22,17 @@ Tracker settings - - - - - - - - true + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok - + + + + + @@ -41,6 +42,12 @@ + + + 0 + 0 + + @@ -64,6 +71,12 @@ + + + 0 + 0 + + Default @@ -99,7 +112,14 @@ - + + + + 0 + 0 + + + @@ -110,6 +130,12 @@ + + + 0 + 0 + + 640x480 @@ -146,154 +172,93 @@ - - + + + + + + + + - Marker pitch + Head X - - + + + + + 0 + 0 + + - -180.000000000000000 + -10000.000000000000000 - 180.000000000000000 + 10000.000000000000000 + + + + + + + + 0 + 0 + + + + -10000.000000000000000 + + + 10000.000000000000000 + + + + + + + + 0 + 0 + + + + -10000.000000000000000 + + + 10000.000000000000000 + + + + + + + Head Z - - - - Head center + + + + Head Y + + + + + + + Calibrate - - - - - Calibrate - - - - - - - TX - - - - - - - - 0 - 0 - - - - -10000.000000000000000 - - - 10000.000000000000000 - - - - - - - - 0 - 0 - - - - -10000.000000000000000 - - - 10000.000000000000000 - - - - - - - - 0 - 0 - - - - -10000.000000000000000 - - - 10000.000000000000000 - - - - - - - TZ - - - - - - - TY - - - - - - - - - 0 - 0 - - - - <html><head/><body><p>The ARUCO Library has been developed by the Ava group of the Univeristy of Cordoba, Spain</p><p>Rafael Muñoz Salinas &lt;<a href="mailto:rmsalinas@uco.es"><span style=" text-decoration: underline; color:#0057ae;">rmsalinas@uco.es</span></a>&gt;</p><p>&lt;<a href="https://github.com/rmsalinas/aruco"><span style=" text-decoration: underline; color:#0057ae;">https://github.com/rmsalinas/aruco</span></a>&gt;</p></body></html> - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - 4 - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - buttonBox - diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 1787ef2b..31aa2372 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -198,7 +198,6 @@ void Tracker::run() int cur_fps = 0; int last_fps = 0; cv::Point2f last_centroid; - bool first = true; while (!stop) { @@ -284,23 +283,19 @@ void Tracker::run() const auto& m = markers.at(0); const float size = 40; - const double p = s.marker_pitch; - const double sq = sin(p * HT_PI / 180); - const double cq = cos(p * HT_PI / 180); - cv::Mat obj_points(4,3,CV_32FC1); obj_points.at(1,0)=-size + s.headpos_x; - obj_points.at(1,1)=-size * cq + s.headpos_y; - obj_points.at(1,2)=-size * sq + s.headpos_z; + obj_points.at(1,1)=-size + s.headpos_y; + obj_points.at(1,2)=-size + s.headpos_z; obj_points.at(2,0)=size + s.headpos_x; - obj_points.at(2,1)=-size * cq + s.headpos_y; - obj_points.at(2,2)=-size * sq + s.headpos_z; + obj_points.at(2,1)=-size + s.headpos_y; + obj_points.at(2,2)=-size + s.headpos_z; obj_points.at(3,0)=size + s.headpos_x; - obj_points.at(3,1)=size * cq + s.headpos_y; - obj_points.at(3,2)=size * sq + s.headpos_z; + obj_points.at(3,1)=size + s.headpos_y; + obj_points.at(3,2)=size + s.headpos_z; obj_points.at(0,0)=-size + s.headpos_x; - obj_points.at(0,1)=size * cq + s.headpos_y; - obj_points.at(0,2)=size * sq + s.headpos_z; + obj_points.at(0,1)=size + s.headpos_y; + obj_points.at(0,2)=size + s.headpos_z; last_roi = cv::Rect(65535, 65535, 0, 0); @@ -325,8 +320,7 @@ void Tracker::run() last_roi.height = std::min(grayscale.rows - last_roi.y, last_roi.height); } - cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, !first, cv::ITERATIVE); - first = false; + cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, false, cv::ITERATIVE); cv::Mat rotation_matrix = cv::Mat::zeros(3, 3, CV_64FC1); cv::Mat junk1(3, 3, CV_64FC1), junk2(3, 3, CV_64FC1); cv::Rodrigues(rvec, rotation_matrix); @@ -334,12 +328,6 @@ void Tracker::run() { cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); - if (fabs(euler[0]) + fabs(s.marker_pitch) > 60) - { - first = true; - qDebug() << "reset levmarq due to pitch breakage"; - } - QMutexLocker lck(&mtx); for (int i = 0; i < 3; i++) @@ -366,10 +354,7 @@ void Tracker::run() last_centroid = repr2[0]; } else - { last_roi = cv::Rect(65535, 65535, 0, 0); - first = true; - } if (frame.rows > 0) videoWidget->update_image(frame); @@ -454,7 +439,6 @@ TrackerControls::TrackerControls() tie_setting(s.headpos_y, ui.cy); tie_setting(s.headpos_z, ui.cz); tie_setting(s.red_only, ui.red_only); - tie_setting(s.marker_pitch, ui.marker_pitch); 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/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 9ac57417..c53a49a4 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -28,7 +28,6 @@ struct settings { value fov, headpos_x, headpos_y, headpos_z; value camera_index, force_fps, resolution; value red_only; - value marker_pitch; settings() : b(bundle("aruco-tracker")), fov(b, "field-of-view", 56), @@ -38,8 +37,7 @@ struct settings { camera_index(b, "camera-index", 0), force_fps(b, "force-fps", 0), resolution(b, "force-resolution", 0), - red_only(b, "red-only", false), - marker_pitch(b, "marker-pitch", 0) + red_only(b, "red-only", false) {} }; -- cgit v1.2.3