From abaf23d7043c42a07e0d71fc0a17a8264c828d48 Mon Sep 17 00:00:00 2001 From: Stéphane Lenclud Date: Sat, 13 Apr 2019 12:59:22 +0200 Subject: EasyTracker: Adding namespace. Reducing number of classes. --- tracker-easy/tracker-easy.h | 94 +++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 45 deletions(-) (limited to 'tracker-easy/tracker-easy.h') 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 #include +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 using pointer = pt_pointer; + template using pointer = pt_pointer; - explicit EasyTracker(pointer 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 traits; + QMutex camera_mtx; - QMutex camera_mtx; + pt_settings s; - pt_settings s; + std::unique_ptr layout; + std::vector iPoints; - std::unique_ptr layout; - std::vector iPoints; + int preview_width = 320, preview_height = 240; - int preview_width = 320, preview_height = 240; + std::unique_ptr point_extractor; + std::unique_ptr camera; + video::impl::camera::info iCameraInfo; + pointer widget; - pointer point_extractor; - std::unique_ptr camera; - video::impl::camera::info iCameraInfo; - pointer widget; + video::frame iFrame; + cv::Mat iMatFrame; + Preview iPreview; - video::frame iFrame; - cv::Mat iMatFrame; - Preview iPreview; + std::atomic point_count{ 0 }; + std::atomic ever_success = false; + mutable QMutex center_lock, data_lock; - std::atomic point_count { 0 }; - std::atomic ever_success = false; - mutable QMutex center_lock, data_lock; + // Translation solutions + std::vector iTranslations; + // Rotation solutions + std::vector iRotations; + // Angle solutions, pitch, yaw, roll, in this order + std::vector 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 iTranslations; - // Rotation solutions - std::vector iRotations; - // Angle solutions, pitch, yaw, roll, in this order - std::vector iAngles; - // The index of our best solution in the above arrays - int iBestSolutionIndex = -1; - // Best translation - cv::Vec3d iBestTranslation; - // Best angles - cv::Vec3d iBestAngles; -}; +} -- cgit v1.2.3