summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ftnoir_tracker_aruco/aruco-trackercontrols.ui204
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp12
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.h1
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 @@
<x>0</x>
<y>0</y>
<width>704</width>
- <height>399</height>
+ <height>339</height>
</rect>
</property>
<property name="sizePolicy">
@@ -112,98 +112,6 @@
</property>
</widget>
</item>
- <item row="7" column="1">
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>Head centroid position</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <layout class="QFormLayout" name="formLayout_2">
- <property name="formAlignment">
- <set>Qt::AlignHCenter|Qt::AlignTop</set>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>TX</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QDoubleSpinBox" name="cx">
- <property name="minimum">
- <double>-200.000000000000000</double>
- </property>
- <property name="maximum">
- <double>200.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>TY</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QDoubleSpinBox" name="cy">
- <property name="minimum">
- <double>-200.000000000000000</double>
- </property>
- <property name="maximum">
- <double>200.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>TZ</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QDoubleSpinBox" name="cz">
- <property name="minimum">
- <double>-200.000000000000000</double>
- </property>
- <property name="maximum">
- <double>200.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Pitch</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QDoubleSpinBox" name="pitch_deg">
- <property name="suffix">
- <string>°</string>
- </property>
- <property name="decimals">
- <number>2</number>
- </property>
- <property name="minimum">
- <double>-60.000000000000000</double>
- </property>
- <property name="maximum">
- <double>60.000000000000000</double>
- </property>
- <property name="value">
- <double>0.000000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
<item row="2" column="1" colspan="2">
<widget class="QComboBox" name="cameraName"/>
</item>
@@ -254,7 +162,7 @@
</property>
</widget>
</item>
- <item row="6" column="2" rowspan="3" colspan="3">
+ <item row="6" column="2" rowspan="4" colspan="3">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -285,7 +193,7 @@
</property>
</widget>
</item>
- <item row="9" column="4">
+ <item row="10" column="4">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
@@ -323,6 +231,112 @@
</property>
</widget>
</item>
+ <item row="7" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>Red channel only</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <widget class="QCheckBox" name="red_only">
+ <property name="text">
+ <string>Recommended!</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1">
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Head centroid position</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <layout class="QFormLayout" name="formLayout_2">
+ <property name="formAlignment">
+ <set>Qt::AlignHCenter|Qt::AlignTop</set>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>TX</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QDoubleSpinBox" name="cx">
+ <property name="minimum">
+ <double>-200.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>200.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>TY</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="cy">
+ <property name="minimum">
+ <double>-200.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>200.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>TZ</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QDoubleSpinBox" name="cz">
+ <property name="minimum">
+ <double>-200.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>200.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Pitch</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QDoubleSpinBox" name="pitch_deg">
+ <property name="suffix">
+ <string>°</string>
+ </property>
+ <property name="decimals">
+ <number>2</number>
+ </property>
+ <property name="minimum">
+ <double>-60.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>60.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>0.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
<tabstops>
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.