diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-30 09:01:32 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-10-30 09:01:32 +0100 |
commit | d785d3616500d5846ac8c5f5a6347da832a593b4 (patch) | |
tree | ac670a125c5b880ad7e4b4f24a8635da4e66f0da /tracker-aruco/ftnoir_tracker_aruco.h | |
parent | 232c2ba8aca7900eaa950c48813ddfaca8a749a8 (diff) | |
parent | 9b736d361bcde7a2ddaf3fe54b471c0e658e94f4 (diff) |
Merge branch 'unstable' into trackhat
* unstable:
cmake: cleanup hydra
rename gui directory
move to subdirectory-based build system
cmake: switch to GNU CC 5.2.0 in mingw-w64 toolchain file
rift-080: forgot ovr_Initialize()
rift 025: fix name
Diffstat (limited to 'tracker-aruco/ftnoir_tracker_aruco.h')
-rw-r--r-- | tracker-aruco/ftnoir_tracker_aruco.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h new file mode 100644 index 00000000..f827da77 --- /dev/null +++ b/tracker-aruco/ftnoir_tracker_aruco.h @@ -0,0 +1,99 @@ +/* Copyright (c) 2013-2015 Stanislaw Halik <sthalik@misaki.pl> + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + */ + +#pragma once + +#include "ui_aruco-trackercontrols.h" +#include "ar_video_widget.h" +#include <QObject> +#include <QThread> +#include <QMutex> +#include <QHBoxLayout> +#include <QDialog> +#include <QTimer> +#include "opentrack/options.hpp" +#include "trans_calib.h" +#include "opentrack/plugin-api.hpp" +#include "opentrack/opencv-camera-dialog.hpp" + +#include <opencv2/core/core.hpp> +#include <opencv2/highgui/highgui.hpp> + +using namespace options; + +struct settings : opts { + value<int> fov; + value<double> headpos_x, headpos_y, headpos_z; + value<QString> camera_name; + value<int> force_fps, resolution; + settings() : + opts("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_name(b, "camera-name", ""), + force_fps(b, "force-fps", 0), + resolution(b, "force-resolution", 0) + {} +}; + +class TrackerControls; + +class Tracker : protected QThread, public ITracker +{ + Q_OBJECT + friend class TrackerControls; + static constexpr double c_search_window = 2.65; +public: + Tracker(); + ~Tracker() override; + void start_tracker(QFrame* frame) override; + void data(double *data) override; + void run() override; + void getRT(cv::Matx33d &r, cv::Vec3d &t); +private: + cv::VideoCapture camera; + QMutex camera_mtx; + QMutex mtx; + volatile bool stop; + QHBoxLayout* layout; + ArucoVideoWidget* videoWidget; + settings s; + double pose[6]; + cv::Mat frame; + cv::Matx33d r; + cv::Vec3d t; +}; + +class TrackerControls : public ITrackerDialog, protected camera_dialog<Tracker> +{ + Q_OBJECT +public: + TrackerControls(); + void register_tracker(ITracker * x) override { tracker = static_cast<Tracker*>(x); } + void unregister_tracker() override { tracker = nullptr; } +private: + Ui::Form ui; + Tracker* tracker; + settings s; + TranslationCalibrator calibrator; + QTimer calib_timer; +private slots: + void doOK(); + void doCancel(); + void toggleCalibrate(); + void cleanupCalib(); + void update_tracker_calibration(); + void camera_settings(); +}; + +class TrackerDll : public Metadata +{ + QString name() { return QString("aruco -- paper marker tracker"); } + QIcon icon() { return QIcon(":/images/aruco.png"); } +}; |