From 55b133b78752137e05aa1437fbe9db83a7324d85 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 Jan 2014 17:47:19 +0100 Subject: aruco: allow for changing marker pitch --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 326 ++++++++++++++------------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 21 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 4 +- 3 files changed, 189 insertions(+), 162 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 3f5a1d2a..e699eccc 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -32,158 +32,6 @@ 7 - - - - - - - Frames per second - - - - - - - - - - 35.000000000000000 - - - 180.000000000000000 - - - 52.000000000000000 - - - - - - - Recommended! - - - - - - - Camera name - - - - - - - - Default - - - - - 30 - - - - - 60 - - - - - 120 - - - - - 180 - - - - - - - - - 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::AlignTop - - - true - - - 4 - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 640x480 - - - - - 320x240 - - - - - 320x200 - - - - - Default (not recommended!) - - - - - - - - Red channel only - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - Horizontal FOV - - - - - - - Resolution - - - @@ -250,7 +98,7 @@ - + Head position @@ -331,6 +179,175 @@ + + + + + + + + + + 35.000000000000000 + + + 180.000000000000000 + + + 52.000000000000000 + + + + + + + Recommended! + + + + + + + Frames per second + + + + + + + + 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::AlignTop + + + true + + + 4 + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + Default + + + + + 30 + + + + + 60 + + + + + 120 + + + + + 180 + + + + + + + + + 640x480 + + + + + 320x240 + + + + + 320x200 + + + + + Default (not recommended!) + + + + + + + + Camera name + + + + + + + Red channel only + + + + + + + Horizontal FOV + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Resolution + + + + + + + Marker pitch + + + + + + + -180.000000000000000 + + + 180.000000000000000 + + + @@ -338,6 +355,8 @@ cameraFPS cameraName resolution + red_only + marker_pitch cx cy cz @@ -347,6 +366,7 @@ tx ty tz + buttonBox diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 9c8cd52b..776d443a 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -282,19 +282,23 @@ void Tracker::run() const aruco::Marker& m = markers.at(0); const float size = 7; + 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 + s.headpos_y; - obj_points.at(1,2)=0 + s.headpos_z; + obj_points.at(1,1)=-size * cq + s.headpos_y; + obj_points.at(1,2)=-size * sq + s.headpos_z; obj_points.at(2,0)=size + s.headpos_x; - obj_points.at(2,1)=-size + s.headpos_y; - obj_points.at(2,2)=0 + s.headpos_z; + obj_points.at(2,1)=-size * cq + s.headpos_y; + obj_points.at(2,2)=-size * sq + s.headpos_z; obj_points.at(3,0)=size + s.headpos_x; - obj_points.at(3,1)=size + s.headpos_y; - obj_points.at(3,2)=0 + s.headpos_z; + obj_points.at(3,1)=size * cq + s.headpos_y; + obj_points.at(3,2)=size * sq + s.headpos_z; obj_points.at(0,0)=-size + s.headpos_x; - obj_points.at(0,1)=size + s.headpos_y; - obj_points.at(0,2)=0 + s.headpos_z; + obj_points.at(0,1)=size * cq + s.headpos_y; + obj_points.at(0,2)=size * sq + s.headpos_z; last_roi = cv::Rect(65535, 65535, 0, 0); @@ -468,6 +472,7 @@ 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())); ui.cameraName->addItems(get_camera_names()); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 91a5ae8e..4cab84b5 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -27,6 +27,7 @@ struct settings { value camera_index, force_fps, resolution; value red_only; value eyaw, epitch, eroll, ex, ey, ez; + value marker_pitch; settings() : b(bundle("aruco-tracker")), fov(b, "field-of-view", 56), @@ -42,7 +43,8 @@ struct settings { eroll(b, "enable-r", true), ex(b, "enable-x", true), ey(b, "enable-y", true), - ez(b, "enable-z", true) + ez(b, "enable-z", true), + marker_pitch(b, "marker-pitch", 0) {} }; -- cgit v1.2.3