summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tracker-aruco/aruco-trackercontrols.ui79
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.cpp39
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.h2
-rw-r--r--tracker-pt/FTNoIR_PT_Controls.ui174
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.cpp39
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.h3
6 files changed, 231 insertions, 105 deletions
diff --git a/tracker-aruco/aruco-trackercontrols.ui b/tracker-aruco/aruco-trackercontrols.ui
index ed1c1edf..71bd1c1c 100644
--- a/tracker-aruco/aruco-trackercontrols.ui
+++ b/tracker-aruco/aruco-trackercontrols.ui
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>485</width>
- <height>180</height>
+ <width>474</width>
+ <height>208</height>
</rect>
</property>
<property name="sizePolicy">
@@ -23,13 +23,6 @@
<string>Tracker settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="1" column="1">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<layout class="QGridLayout" name="gridLayout_3">
@@ -47,13 +40,6 @@
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Resolution</string>
- </property>
- </widget>
- </item>
<item row="3" column="1">
<widget class="QComboBox" name="resolution">
<property name="sizePolicy">
@@ -84,6 +70,13 @@
</item>
</widget>
</item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Resolution</string>
+ </property>
+ </widget>
+ </item>
<item row="1" column="1">
<widget class="QComboBox" name="cameraFPS">
<property name="sizePolicy">
@@ -131,15 +124,18 @@
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QComboBox" name="cameraName">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="5" column="1">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- </widget>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="cameraFOV">
@@ -160,18 +156,28 @@
</property>
</widget>
</item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="cameraName">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
<item row="4" column="1">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
+ <widget class="QPushButton" name="camera_settings">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
+ <property name="text">
+ <string>Camera settings</string>
</property>
- </spacer>
+ </widget>
</item>
</layout>
</widget>
@@ -261,6 +267,13 @@
</layout>
</widget>
</item>
+ <item row="1" column="1">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<tabstops>
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp
index d59ac9be..81a2e176 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.cpp
+++ b/tracker-aruco/ftnoir_tracker_aruco.cpp
@@ -7,13 +7,15 @@
#include "ftnoir_tracker_aruco.h"
#include "api/plugin-api.hpp"
+#include "compat/camera-names.hpp"
+#include "compat/sleep.hpp"
+#include "compat/pi-constant.hpp"
+#include "cv/video-property-page.hpp"
+
#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/calib3d.hpp>
-#include "compat/camera-names.hpp"
-#include "compat/sleep.hpp"
-#include "compat/pi-constant.hpp"
#include <QMutexLocker>
#include <QDebug>
@@ -425,7 +427,38 @@ TrackerControls::TrackerControls()
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
connect(ui.btn_calibrate, SIGNAL(clicked()), this, SLOT(toggleCalibrate()));
connect(this, SIGNAL(destroyed()), this, SLOT(cleanupCalib()));
+
connect(&calib_timer, SIGNAL(timeout()), this, SLOT(update_tracker_calibration()));
+ connect(ui.cameraName, &QComboBox::currentTextChanged, this, &TrackerControls::set_camera_settings_available);
+ set_camera_settings_available(ui.cameraName->currentText());
+ connect(ui.camera_settings, &QPushButton::clicked, this, &TrackerControls::show_camera_settings);
+}
+
+
+void TrackerControls::set_camera_settings_available(const QString& camera_name)
+{
+#ifdef _WIN32
+ const bool avail = camera_name != QStringLiteral("PS3Eye Camera");
+ ui.camera_settings->setEnabled(avail);
+#elif defined(__linux)
+ (void)camera_name;
+#else
+ (void)camera_name;
+ ui.camera_settings->setEnabled(false);
+#endif
+}
+
+void TrackerControls::show_camera_settings()
+{
+ const int idx = ui.cameraName->currentIndex();
+ if (tracker)
+ {
+ cv::VideoCapture& cap = tracker->camera;
+ if (cap.isOpened())
+ video_property_page::show_from_capture(cap, idx);
+ }
+ else
+ video_property_page::show(idx);
}
void TrackerControls::toggleCalibrate()
diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h
index 101060f7..41063ca0 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.h
+++ b/tracker-aruco/ftnoir_tracker_aruco.h
@@ -125,6 +125,8 @@ private slots:
void toggleCalibrate();
void cleanupCalib();
void update_tracker_calibration();
+ void set_camera_settings_available(const QString& camera_name);
+ void show_camera_settings();
};
class TrackerDll : public Metadata
diff --git a/tracker-pt/FTNoIR_PT_Controls.ui b/tracker-pt/FTNoIR_PT_Controls.ui
index 2675f1a4..02eb05fb 100644
--- a/tracker-pt/FTNoIR_PT_Controls.ui
+++ b/tracker-pt/FTNoIR_PT_Controls.ui
@@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>424</width>
- <height>568</height>
+ <height>586</height>
</rect>
</property>
<property name="sizePolicy">
@@ -67,24 +67,37 @@
<string>Camera settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
- <item row="3" column="0">
- <widget class="QLabel" name="label_37">
+ <item row="0" column="1">
+ <widget class="QComboBox" name="camdevice_combo">
<property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text">
- <string>FPS</string>
+ <property name="minimumContentsLength">
+ <number>10</number>
</property>
- <property name="buddy">
- <cstring>fps_spin</cstring>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QSpinBox" name="fov">
+ <property name="suffix">
+ <string>°</string>
+ </property>
+ <property name="prefix">
+ <string/>
+ </property>
+ <property name="minimum">
+ <number>10</number>
+ </property>
+ <property name="maximum">
+ <number>90</number>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_36">
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -92,12 +105,12 @@
</sizepolicy>
</property>
<property name="text">
- <string>Width</string>
+ <string>Diagonal field of view</string>
</property>
</widget>
</item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_4">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_36">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -105,23 +118,23 @@
</sizepolicy>
</property>
<property name="text">
- <string>Diagonal field of view</string>
+ <string>Width</string>
</property>
</widget>
</item>
- <item row="4" column="1">
- <widget class="QSpinBox" name="fov">
- <property name="suffix">
- <string>°</string>
- </property>
- <property name="prefix">
- <string/>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_37">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="minimum">
- <number>10</number>
+ <property name="text">
+ <string>FPS</string>
</property>
- <property name="maximum">
- <number>90</number>
+ <property name="buddy">
+ <cstring>fps_spin</cstring>
</property>
</widget>
</item>
@@ -180,29 +193,25 @@
</property>
</widget>
</item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_5">
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="res_x_spin">
<property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text">
- <string>Dynamic pose resolution</string>
+ <property name="toolTip">
+ <string>Desired capture width</string>
</property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QSpinBox" name="init_phase_timeout">
<property name="suffix">
- <string> ms</string>
- </property>
- <property name="minimum">
- <number>1</number>
+ <string> px</string>
</property>
<property name="maximum">
- <number>10000</number>
+ <number>2000</number>
+ </property>
+ <property name="singleStep">
+ <number>10</number>
</property>
</widget>
</item>
@@ -219,25 +228,29 @@
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="res_x_spin">
+ <item row="6" column="1">
+ <widget class="QSpinBox" name="init_phase_timeout">
+ <property name="suffix">
+ <string> ms</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>10000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_5">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="toolTip">
- <string>Desired capture width</string>
- </property>
- <property name="suffix">
- <string> px</string>
- </property>
- <property name="maximum">
- <number>2000</number>
- </property>
- <property name="singleStep">
- <number>10</number>
+ <property name="text">
+ <string>Dynamic pose resolution</string>
</property>
</widget>
</item>
@@ -257,16 +270,23 @@
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QComboBox" name="camdevice_combo">
+ <item row="7" column="1">
+ <widget class="QPushButton" name="camera_settings">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumContentsLength">
- <number>10</number>
+ <property name="text">
+ <string>Open</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Camera settings (when available)</string>
</property>
</widget>
</item>
@@ -1104,8 +1124,14 @@
</widget>
</widget>
</item>
- <item row="1" column="0">
+ <item row="2" column="0">
<widget class="QGroupBox" name="groupBox_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="title">
<string>Status</string>
</property>
@@ -1117,13 +1143,6 @@
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
<item row="0" column="0">
<widget class="QLabel" name="label_38">
<property name="text">
@@ -1166,6 +1185,29 @@
</layout>
</widget>
</item>
+ <item row="1" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<tabstops>
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
index 4e1df41b..c722e9a7 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
@@ -7,6 +7,7 @@
*/
#include "ftnoir_tracker_pt_dialog.h"
+#include "cv/video-property-page.hpp"
#include "compat/camera-names.hpp"
#include <opencv2/core/core.hpp>
@@ -71,6 +72,10 @@ TrackerDialog_PT::TrackerDialog_PT()
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
+ connect(ui.camdevice_combo, &QComboBox::currentTextChanged, this, &TrackerDialog_PT::set_camera_settings_available);
+ set_camera_settings_available(ui.camdevice_combo->currentText());
+ connect(ui.camera_settings, &QPushButton::clicked, this, &TrackerDialog_PT::show_camera_settings);
+
connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info()));
timer.start(250);
@@ -97,9 +102,9 @@ void TrackerDialog_PT::startstop_trans_calib(bool start)
trans_calib_running = false;
{
auto tmp = trans_calib.get_estimate();
- s.t_MH_x = tmp[0];
- s.t_MH_y = tmp[1];
- s.t_MH_z = tmp[2];
+ s.t_MH_x = int(tmp[0]);
+ s.t_MH_y = int(tmp[1]);
+ s.t_MH_z = int(tmp[2]);
}
}
ui.tx_spin->setEnabled(!start);
@@ -144,6 +149,34 @@ void TrackerDialog_PT::poll_tracker_info()
}
}
+void TrackerDialog_PT::set_camera_settings_available(const QString& camera_name)
+{
+#ifdef _WIN32
+ const bool avail = camera_name != QStringLiteral("PS3Eye Camera");
+ ui.camera_settings->setEnabled(avail);
+#elif defined(__linux)
+ (void)camera_name;
+#else
+ (void)camera_name;
+ ui.camera_settings->setEnabled(false);
+#endif
+}
+
+void TrackerDialog_PT::show_camera_settings()
+{
+ const int idx = ui.camdevice_combo->currentIndex();
+ if (tracker)
+ {
+ cv::VideoCapture* cap = tracker->camera;
+ if (cap && cap->isOpened())
+ {
+ video_property_page::show_from_capture(*cap, idx);
+ }
+ }
+ else
+ video_property_page::show(idx);
+}
+
void TrackerDialog_PT::trans_calib_step()
{
if (tracker)
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.h b/tracker-pt/ftnoir_tracker_pt_dialog.h
index b57e32c3..b5adea51 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.h
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.h
@@ -32,6 +32,9 @@ public slots:
void startstop_trans_calib(bool start);
void trans_calib_step();
void poll_tracker_info();
+ void set_camera_settings_available(const QString& camera_name);
+ void show_camera_settings();
+
private:
settings_pt s;
Tracker_PT* tracker;