summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_tracker_aruco/ftnoir_tracker_aruco.h')
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.h90
1 files changed, 50 insertions, 40 deletions
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
index 7f21f020..4cab84b5 100644
--- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
+++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
@@ -10,46 +10,63 @@
#include "ftnoir_tracker_base/ftnoir_tracker_base.h"
#include "ui_aruco-trackercontrols.h"
-#include "video_widget.h"
+#include "ar_video_widget.h"
#include <QObject>
-#include <QTimer>
#include <QThread>
#include <QMutex>
#include <QHBoxLayout>
+#include <QDialog>
#include <opencv2/opencv.hpp>
+#include <opencv/highgui.h>
+#include "facetracknoir/options.h"
+using namespace options;
-class Tracker : public QThread, public ITracker
+struct settings {
+ pbundle b;
+ value<double> fov, headpos_x, headpos_y, headpos_z;
+ value<int> camera_index, force_fps, resolution;
+ value<bool> red_only;
+ value<bool> eyaw, epitch, eroll, ex, ey, ez;
+ value<double> marker_pitch;
+ settings() :
+ b(bundle("aruco-tracker")),
+ fov(b, "field-of-view", 56),
+ headpos_x(b, "headpos-x", 0),
+ headpos_y(b, "headpos-y", 0),
+ headpos_z(b, "headpos-z", 0),
+ camera_index(b, "camera-index", 0),
+ force_fps(b, "force-fps", 0),
+ resolution(b, "force-resolution", 0),
+ red_only(b, "red-only", false),
+ eyaw(b, "enable-y", true),
+ epitch(b, "enable-p", true),
+ eroll(b, "enable-r", true),
+ ex(b, "enable-x", true),
+ ey(b, "enable-y", true),
+ ez(b, "enable-z", true),
+ marker_pitch(b, "marker-pitch", 0)
+ {}
+};
+
+class Tracker : protected QThread, public ITracker
{
Q_OBJECT
public:
Tracker();
- ~Tracker();
+ virtual ~Tracker();
void StartTracker(QFrame* frame);
- bool GiveHeadPoseData(double *data);
- bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ;
- bool NeedsTimeToFinish() {
- return true;
- }
- void WaitForExit() {
- stop = true;
- wait();
- }
+ void GetHeadPoseData(double *data);
void run();
+ void reload() { s.b->reload(); }
private:
QMutex mtx;
- QTimer timer;
- VideoWidget* videoWidget;
- QHBoxLayout* layout;
- volatile bool fresh, stop;
- float fov;
- int camera_index;
- float dc[5];
- int force_fps, force_width, force_height;
- void load_settings();
+ volatile bool stop;
+ QHBoxLayout* layout;
+ ArucoVideoWidget* videoWidget;
+ settings s;
double pose[6];
cv::Mat frame;
-private slots:
- void paint_widget();
+ cv::VideoCapture camera;
};
// Widget that has controls for FTNoIR protocol client-settings.
@@ -57,27 +74,20 @@ class TrackerControls : public QWidget, public ITrackerDialog
{
Q_OBJECT
public:
-
- explicit TrackerControls();
- virtual ~TrackerControls();
- void showEvent ( QShowEvent * event );
-
- void Initialize(QWidget *parent);
- void registerTracker(ITracker *tracker) {}
- void unRegisterTracker() {}
-
+ TrackerControls();
+ void registerTracker(ITracker * x) {
+ tracker = dynamic_cast<Tracker*>(x);
+ }
+ void unRegisterTracker() {
+ tracker = nullptr;
+ }
private:
Ui::Form ui;
- void loadSettings();
- void save();
- bool settingsDirty;
-
+ Tracker* tracker;
+ settings s;
private slots:
void doOK();
void doCancel();
- void settingChanged() { settingsDirty = true; }
- void settingChanged(int) { settingsDirty = true; }
- void settingChanged(double) { settingsDirty = true; }
};
#endif