summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStéphane Lenclud <github@lenclud.com>2019-04-14 11:40:52 +0200
committerStéphane Lenclud <github@lenclud.com>2019-04-14 11:40:52 +0200
commit3b19264b7425ecd13c5c7ab470cb3c91dd257d44 (patch)
tree0b22792f3d3c8cefac3a6f28d7c2d44eebe0ef31
parent89cf8c3ce50e8989ad0add2694bf54e49d800309 (diff)
Easy Tracker: Renaming settings.
-rw-r--r--tracker-easy/module.cpp2
-rw-r--r--tracker-easy/point-extractor.cpp (renamed from tracker-easy/cv-point-extractor.cpp)6
-rw-r--r--tracker-easy/point-extractor.h (renamed from tracker-easy/cv-point-extractor.h)6
-rw-r--r--tracker-easy/pt-settings.hpp73
-rw-r--r--tracker-easy/settings.h71
-rw-r--r--tracker-easy/tracker-easy-api.h29
-rw-r--r--tracker-easy/tracker-easy-dialog.h2
-rw-r--r--tracker-easy/tracker-easy.cpp4
-rw-r--r--tracker-easy/tracker-easy.h5
9 files changed, 91 insertions, 107 deletions
diff --git a/tracker-easy/module.cpp b/tracker-easy/module.cpp
index b6d21c80..b7b60fa8 100644
--- a/tracker-easy/module.cpp
+++ b/tracker-easy/module.cpp
@@ -2,7 +2,7 @@
#include "tracker-easy-dialog.h"
#include "tracker-easy-api.h"
#include "module.hpp"
-#include "cv-point-extractor.h"
+#include "point-extractor.h"
#include <memory>
diff --git a/tracker-easy/cv-point-extractor.cpp b/tracker-easy/point-extractor.cpp
index c7a3c958..d8ea3c53 100644
--- a/tracker-easy/cv-point-extractor.cpp
+++ b/tracker-easy/point-extractor.cpp
@@ -6,7 +6,7 @@
* copyright notice and this permission notice appear in all copies.
*/
-#include "cv-point-extractor.h"
+#include "point-extractor.h"
#include "preview.h"
#include "tracker-easy.h"
@@ -26,13 +26,13 @@ using namespace numeric_types;
namespace EasyTracker
{
- CvPointExtractor::CvPointExtractor() : s(KModuleName)
+ PointExtractor::PointExtractor() : s(KModuleName)
{
}
- void CvPointExtractor::extract_points(const cv::Mat& aFrame, cv::Mat* aPreview, std::vector<vec2>& aPoints)
+ void PointExtractor::extract_points(const cv::Mat& aFrame, cv::Mat* aPreview, std::vector<vec2>& aPoints)
{
//TODO: Assert if channel size is neither one nor two
// Make sure our frame channel is 8 bit
diff --git a/tracker-easy/cv-point-extractor.h b/tracker-easy/point-extractor.h
index 677be292..d6bbd241 100644
--- a/tracker-easy/cv-point-extractor.h
+++ b/tracker-easy/point-extractor.h
@@ -22,15 +22,15 @@ namespace EasyTracker
{
- class CvPointExtractor final : public IPointExtractor
+ class PointExtractor final : public IPointExtractor
{
public:
// extracts points from frame and draws some processing info into frame, if draw_output is set
// dt: time since last call in seconds
void extract_points(const cv::Mat& aFrame, cv::Mat* aPreview, std::vector<vec2>& aPoints) override;
- CvPointExtractor();
+ PointExtractor();
// Settings
- pt_settings s;
+ Settings s;
// Our frame with a channel size of 8 bits
cv::Mat iFrameChannelSizeOne;
// Our frame with a single 8 bits channel
diff --git a/tracker-easy/pt-settings.hpp b/tracker-easy/pt-settings.hpp
deleted file mode 100644
index 723ee08d..00000000
--- a/tracker-easy/pt-settings.hpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#pragma once
-
-#include "options/options.hpp"
-
-#include <QString>
-
-enum pt_color_type
-{
- // explicit values, gotta preserve the numbering in .ini
- // don't reuse when removing some of the modes
- pt_color_natural = 2,
- pt_color_red_only = 3,
- pt_color_average = 5,
- pt_color_blue_only = 6,
- pt_color_green_only = 7,
-};
-
-namespace pt_impl {
-
-using namespace options;
-
-#ifdef __clang__
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wweak-vtables"
-#endif
-
-struct pt_settings final : options::opts
-{
- using slider_value = options::slider_value;
-
- value<QString> camera_name { b, "camera-name", "" };
- value<int> cam_res_x { b, "camera-res-width", 640 },
- cam_res_y { b, "camera-res-height", 480 },
- cam_fps { b, "camera-fps", 30 };
- value<double> min_point_size { b, "min-point-size", 2.5 },
- max_point_size { b, "max-point-size", 50 };
-
- value<int> m01_x { b, "m_01-x", 0 }, m01_y { b, "m_01-y", 0 }, m01_z { b, "m_01-z", 0 };
- value<int> m02_x { b, "m_02-x", 0 }, m02_y { b, "m_02-y", 0 }, m02_z { b, "m_02-z", 0 };
-
- value<int> t_MH_x { b, "model-centroid-x", 0 },
- t_MH_y { b, "model-centroid-y", 0 },
- t_MH_z { b, "model-centroid-z", 0 };
-
- value<int> clip_ty { b, "clip-ty", 40 },
- clip_tz { b, "clip-tz", 30 },
- clip_by { b, "clip-by", 70 },
- clip_bz { b, "clip-bz", 80 };
-
- value<int> active_model_panel { b, "active-model-panel", 0 },
- cap_x { b, "cap-x", 40 },
- cap_y { b, "cap-y", 60 },
- cap_z { b, "cap-z", 100 };
-
- value<int> fov { b, "camera-fov", 56 };
-
- value<bool> dynamic_pose { b, "dynamic-pose-resolution", false };
- value<int> init_phase_timeout { b, "init-phase-timeout", 250 };
- value<bool> auto_threshold { b, "automatic-threshold", true };
- value<pt_color_type> blob_color { b, "blob-color", pt_color_natural };
-
- value<slider_value> threshold_slider { b, "threshold-slider", { 128, 0, 255 } };
-
- explicit pt_settings(const QString& name) : opts(name) {}
-};
-
-#ifdef __clang__
-# pragma clang diagnostic pop
-#endif
-
-} // ns pt_impl
-
-using pt_settings = pt_impl::pt_settings;
diff --git a/tracker-easy/settings.h b/tracker-easy/settings.h
new file mode 100644
index 00000000..7d8c7c70
--- /dev/null
+++ b/tracker-easy/settings.h
@@ -0,0 +1,71 @@
+#pragma once
+
+#include "options/options.hpp"
+
+#include <QString>
+
+enum pt_color_type
+{
+ // explicit values, gotta preserve the numbering in .ini
+ // don't reuse when removing some of the modes
+ pt_color_natural = 2,
+ pt_color_red_only = 3,
+ pt_color_average = 5,
+ pt_color_blue_only = 6,
+ pt_color_green_only = 7,
+};
+
+namespace EasyTracker {
+
+ using namespace options;
+
+#ifdef __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wweak-vtables"
+#endif
+
+ struct Settings final : options::opts
+ {
+ using slider_value = options::slider_value;
+
+ value<QString> camera_name{ b, "camera-name", "" };
+ value<int> cam_res_x{ b, "camera-res-width", 640 },
+ cam_res_y{ b, "camera-res-height", 480 },
+ cam_fps{ b, "camera-fps", 30 };
+ value<double> min_point_size{ b, "min-point-size", 2.5 },
+ max_point_size{ b, "max-point-size", 50 };
+
+ value<int> m01_x{ b, "m_01-x", 0 }, m01_y{ b, "m_01-y", 0 }, m01_z{ b, "m_01-z", 0 };
+ value<int> m02_x{ b, "m_02-x", 0 }, m02_y{ b, "m_02-y", 0 }, m02_z{ b, "m_02-z", 0 };
+
+ value<int> t_MH_x{ b, "model-centroid-x", 0 },
+ t_MH_y{ b, "model-centroid-y", 0 },
+ t_MH_z{ b, "model-centroid-z", 0 };
+
+ value<int> clip_ty{ b, "clip-ty", 40 },
+ clip_tz{ b, "clip-tz", 30 },
+ clip_by{ b, "clip-by", 70 },
+ clip_bz{ b, "clip-bz", 80 };
+
+ value<int> active_model_panel{ b, "active-model-panel", 0 },
+ cap_x{ b, "cap-x", 40 },
+ cap_y{ b, "cap-y", 60 },
+ cap_z{ b, "cap-z", 100 };
+
+ value<int> fov{ b, "camera-fov", 56 };
+
+ value<bool> dynamic_pose{ b, "dynamic-pose-resolution", false };
+ value<int> init_phase_timeout{ b, "init-phase-timeout", 250 };
+ value<bool> auto_threshold{ b, "automatic-threshold", true };
+ value<pt_color_type> blob_color{ b, "blob-color", pt_color_natural };
+
+ value<slider_value> threshold_slider{ b, "threshold-slider", { 128, 0, 255 } };
+
+ explicit Settings(const QString& name) : opts(name) {}
+ };
+
+#ifdef __clang__
+# pragma clang diagnostic pop
+#endif
+
+} //
diff --git a/tracker-easy/tracker-easy-api.h b/tracker-easy/tracker-easy-api.h
index e5627d11..b50ce018 100644
--- a/tracker-easy/tracker-easy-api.h
+++ b/tracker-easy/tracker-easy-api.h
@@ -1,6 +1,13 @@
+/* Copyright (c) 2019 Stephane Lenclud
+ *
+ * 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 "pt-settings.hpp"
+#include "settings.h"
#include "cv/numeric.hpp"
#include "options/options.hpp"
@@ -15,10 +22,6 @@
#include <QImage>
#include <QString>
-#ifdef __clang__
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wweak-vtables"
-#endif
const int KPointCount = 3;
@@ -31,20 +34,4 @@ public:
virtual void extract_points(const cv::Mat& image, cv::Mat* aPreview, std::vector<vec2>& aPoints) = 0;
};
-struct IEasyTrackerTraits
-{
- template<typename t> using pointer = std::shared_ptr<t>;
-
- IEasyTrackerTraits();
- virtual ~IEasyTrackerTraits();
-
- virtual pointer<IPointExtractor> make_point_extractor() const = 0;
- virtual QString get_module_name() const = 0;
-};
-
-template<typename t>
-using pt_pointer = typename IEasyTrackerTraits::pointer<t>;
-#ifdef __clang__
-# pragma clang diagnostic pop
-#endif
diff --git a/tracker-easy/tracker-easy-dialog.h b/tracker-easy/tracker-easy-dialog.h
index 86b9771b..861e0ff9 100644
--- a/tracker-easy/tracker-easy-dialog.h
+++ b/tracker-easy/tracker-easy-dialog.h
@@ -41,7 +41,7 @@ namespace EasyTracker
protected:
QString threshold_display_text(int threshold_value);
- pt_settings s;
+ Settings s;
Tracker* tracker;
QTimer timer, calib_timer;
TranslationCalibrator trans_calib;
diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp
index 083bd951..acedc379 100644
--- a/tracker-easy/tracker-easy.cpp
+++ b/tracker-easy/tracker-easy.cpp
@@ -11,7 +11,7 @@
#include "video/video-widget.hpp"
#include "compat/math-imports.hpp"
#include "compat/check-visible.hpp"
-#include "cv-point-extractor.h"
+#include "point-extractor.h"
#include "tracker-easy-api.h"
#include <QHBoxLayout>
@@ -36,7 +36,7 @@ namespace EasyTracker
Tracker::Tracker() :
s{ KModuleName },
- point_extractor{ std::make_unique<CvPointExtractor>() },
+ point_extractor{ std::make_unique<PointExtractor>() },
iPreview{ preview_width, preview_height }
{
cv::setBreakOnError(true);
diff --git a/tracker-easy/tracker-easy.h b/tracker-easy/tracker-easy.h
index 341d676b..57419c1c 100644
--- a/tracker-easy/tracker-easy.h
+++ b/tracker-easy/tracker-easy.h
@@ -38,7 +38,6 @@ namespace EasyTracker
{
friend class Dialog;
- template<typename t> using pointer = pt_pointer<t>;
explicit Tracker();
~Tracker() override;
@@ -57,7 +56,7 @@ namespace EasyTracker
QMutex camera_mtx;
- pt_settings s;
+ Settings s;
std::unique_ptr<QLayout> layout;
std::vector<vec2> iPoints;
@@ -67,7 +66,7 @@ namespace EasyTracker
std::unique_ptr<IPointExtractor> point_extractor;
std::unique_ptr<video::impl::camera> camera;
video::impl::camera::info iCameraInfo;
- pointer<video_widget> widget;
+ std::unique_ptr<video_widget> widget;
video::frame iFrame;
cv::Mat iMatFrame;