diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-12-29 03:35:03 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-12-29 03:35:03 +0100 |
commit | fbbe79400ddf7397f2ec09e679ac79e139ebb1d5 (patch) | |
tree | c4e62f405d174db1f05830a203809cc0f16fdef0 /ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | |
parent | fbef92577584a6000cdbcffa5744b77d28f1dc0c (diff) |
aruco: allow for filter only red spectrum
Diffstat (limited to 'ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp')
-rw-r--r-- | ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
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) |