From fbbe79400ddf7397f2ec09e679ac79e139ebb1d5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 29 Dec 2013 03:35:03 +0100 Subject: aruco: allow for filter only red spectrum --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 204 ++++++++++++++------------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 12 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 1 + 3 files changed, 120 insertions(+), 97 deletions(-) diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 629d1bbb..710a33e1 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -10,7 +10,7 @@ 0 0 704 - 399 + 339 @@ -112,98 +112,6 @@ - - - - Head centroid position - - - Qt::AlignCenter - - - - Qt::AlignHCenter|Qt::AlignTop - - - - - TX - - - - - - - -200.000000000000000 - - - 200.000000000000000 - - - - - - - TY - - - - - - - -200.000000000000000 - - - 200.000000000000000 - - - - - - - TZ - - - - - - - -200.000000000000000 - - - 200.000000000000000 - - - - - - - Pitch - - - - - - - ° - - - 2 - - - -60.000000000000000 - - - 60.000000000000000 - - - 0.000000000000000 - - - - - - @@ -254,7 +162,7 @@ - + @@ -285,7 +193,7 @@ - + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -323,6 +231,112 @@ + + + + Red channel only + + + + + + + Recommended! + + + + + + + Head centroid position + + + Qt::AlignCenter + + + + Qt::AlignHCenter|Qt::AlignTop + + + + + TX + + + + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + TY + + + + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + TZ + + + + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + Pitch + + + + + + + ° + + + 2 + + + -60.000000000000000 + + + 60.000000000000000 + + + 0.000000000000000 + + + + + + diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 4c900ab4..9408de02 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -128,6 +128,7 @@ void Tracker::load_settings() headpos[i] = iniFile.value(QString("headpos-%1").arg(i), 0).toDouble(); } headpitch = iniFile.value("pitch", 0).toDouble(); + red_only = iniFile.value("red-only", true).toBool(); iniFile.endGroup(); } @@ -215,7 +216,13 @@ void Tracker::run() continue; auto tm = cv::getTickCount(); color_.copyTo(color); - cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); + if (red_only) + { + cv::Mat channel[3]; + cv::split(color, channel); + grayscale = channel[2]; + } else + cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); @@ -546,7 +553,7 @@ void TrackerControls::loadSettings() } ui.pitch_deg->setValue(iniFile.value("pitch", 0).toDouble()); - + ui.red_only->setChecked(iniFile.value("red-only", true).toBool()); iniFile.endGroup(); settingsDirty = false; } @@ -597,6 +604,7 @@ void TrackerControls::save() { iniFile.setValue(QString("headpos-%1").arg(i), headpos[i]->value()); } + iniFile.setValue("red-only", ui.red_only->isChecked()); iniFile.endGroup(); settingsDirty = false; if (tracker) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index be2ad3d7..545ad5d0 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -42,6 +42,7 @@ private: cv::Mat frame; double headpos[3], headpitch; cv::VideoCapture camera; + volatile bool red_only; }; // Widget that has controls for FTNoIR protocol client-settings. -- cgit v1.2.3