diff options
author | Stéphane Lenclud <github@lenclud.com> | 2019-04-13 12:59:22 +0200 |
---|---|---|
committer | Stéphane Lenclud <github@lenclud.com> | 2019-04-24 18:46:12 +0200 |
commit | abaf23d7043c42a07e0d71fc0a17a8264c828d48 (patch) | |
tree | b5e8f14e4730bb45d26d2858a26ac2c6cbfc23a8 /tracker-easy/tracker-easy.h | |
parent | ac8f7a3e7b29a5ce60ae751ee3a97e3b344c8f3f (diff) |
EasyTracker: Adding namespace. Reducing number of classes.
Diffstat (limited to 'tracker-easy/tracker-easy.h')
-rw-r--r-- | tracker-easy/tracker-easy.h | 94 |
1 files changed, 49 insertions, 45 deletions
diff --git a/tracker-easy/tracker-easy.h b/tracker-easy/tracker-easy.h index 3055299b..341d676b 100644 --- a/tracker-easy/tracker-easy.h +++ b/tracker-easy/tracker-easy.h @@ -25,66 +25,70 @@ #include <QMutex> #include <QLayout> +namespace EasyTracker +{ -class EasyTrackerDialog; + static const QString KModuleName = "tracker-easy"; -using namespace numeric_types; + class Dialog; -struct EasyTracker : QThread, ITracker -{ - friend class EasyTrackerDialog; + using namespace numeric_types; + + struct Tracker : QThread, ITracker + { + friend class Dialog; - template<typename t> using pointer = pt_pointer<t>; + template<typename t> using pointer = pt_pointer<t>; - explicit EasyTracker(pointer<IEasyTrackerTraits> const& pt_runtime_traits); - ~EasyTracker() override; - module_status start_tracker(QFrame* parent_window) override; - void data(double* data) override; - bool center() override; + explicit Tracker(); + ~Tracker() override; + module_status start_tracker(QFrame* parent_window) override; + void data(double* data) override; + bool center() override; - int get_n_points(); + int get_n_points(); -private: - void run() override; + private: + void run() override; - bool maybe_reopen_camera(); - void set_fov(int value); + bool maybe_reopen_camera(); + void set_fov(int value); - pointer<IEasyTrackerTraits> traits; + QMutex camera_mtx; - QMutex camera_mtx; + pt_settings s; - pt_settings s; + std::unique_ptr<QLayout> layout; + std::vector<vec2> iPoints; - std::unique_ptr<QLayout> layout; - std::vector<vec2> iPoints; + int preview_width = 320, preview_height = 240; - int preview_width = 320, preview_height = 240; + std::unique_ptr<IPointExtractor> point_extractor; + std::unique_ptr<video::impl::camera> camera; + video::impl::camera::info iCameraInfo; + pointer<video_widget> widget; - pointer<IPointExtractor> point_extractor; - std::unique_ptr<video::impl::camera> camera; - video::impl::camera::info iCameraInfo; - pointer<video_widget> widget; + video::frame iFrame; + cv::Mat iMatFrame; + Preview iPreview; - video::frame iFrame; - cv::Mat iMatFrame; - Preview iPreview; + std::atomic<unsigned> point_count{ 0 }; + std::atomic<bool> ever_success = false; + mutable QMutex center_lock, data_lock; - std::atomic<unsigned> point_count { 0 }; - std::atomic<bool> ever_success = false; - mutable QMutex center_lock, data_lock; + // Translation solutions + std::vector<cv::Mat> iTranslations; + // Rotation solutions + std::vector<cv::Mat> iRotations; + // Angle solutions, pitch, yaw, roll, in this order + std::vector<cv::Vec3d> iAngles; + // The index of our best solution in the above arrays + int iBestSolutionIndex = -1; + // Best translation + cv::Vec3d iBestTranslation; + // Best angles + cv::Vec3d iBestAngles; + }; - // Translation solutions - std::vector<cv::Mat> iTranslations; - // Rotation solutions - std::vector<cv::Mat> iRotations; - // Angle solutions, pitch, yaw, roll, in this order - std::vector<cv::Vec3d> iAngles; - // The index of our best solution in the above arrays - int iBestSolutionIndex = -1; - // Best translation - cv::Vec3d iBestTranslation; - // Best angles - cv::Vec3d iBestAngles; -}; +} |