summaryrefslogtreecommitdiffhomepage
path: root/tracker-aruco
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-17 16:11:44 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-17 16:20:20 +0200
commit159ccb4bca654acdb101cfa1fd3491d1f7964743 (patch)
tree193812dcd731de102271237904055fba970792e7 /tracker-aruco
parentc7215393794b7a901cfcca22c9afe200f5bb959e (diff)
tracker/{pt,aruco}: enable camera dialog
Suggested-by: MathijsG Issue: #454
Diffstat (limited to 'tracker-aruco')
-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
3 files changed, 84 insertions, 36 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