diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 18:54:34 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 19:32:10 +0100 |
commit | a88e34b21b07f70123926fcb5c505d6afdf99807 (patch) | |
tree | 905059194dcc64c7c163b8912947d8173fd4cc91 /tracker-pt/module | |
parent | 5bf85412e4eacf92acc936b6e74bce0e2b1055d9 (diff) |
style/quality only
No functional changes.
- add `override' everywhere where missing
- almost pass clang's `-Wweak-vtables'
- avoid some float/double conversions
- remove unused private members
- make signedness conversions explicit
- put stuff in right namespaces to aid analysis
Diffstat (limited to 'tracker-pt/module')
-rw-r--r-- | tracker-pt/module/camera.cpp | 10 | ||||
-rw-r--r-- | tracker-pt/module/frame.cpp | 4 | ||||
-rw-r--r-- | tracker-pt/module/frame.hpp | 12 | ||||
-rw-r--r-- | tracker-pt/module/module.cpp | 16 | ||||
-rw-r--r-- | tracker-pt/module/module.hpp | 4 | ||||
-rw-r--r-- | tracker-pt/module/point_extractor.cpp | 9 |
6 files changed, 39 insertions, 16 deletions
diff --git a/tracker-pt/module/camera.cpp b/tracker-pt/module/camera.cpp index 85439431..1b948932 100644 --- a/tracker-pt/module/camera.cpp +++ b/tracker-pt/module/camera.cpp @@ -19,6 +19,7 @@ #include <cstdlib> using namespace pt_module; +namespace pt_module { Camera::Camera(const QString& module_name) : s { module_name } { @@ -141,10 +142,10 @@ bool Camera::start(int idx, int fps, int res_x, int res_y) void Camera::stop() { cap = nullptr; - desired_name = QString(); - active_name = QString(); - cam_info = pt_camera_info(); - cam_desired = pt_camera_info(); + desired_name = QString{}; + active_name = QString{}; + cam_info = {}; + cam_desired = {}; } bool Camera::get_frame_(cv::Mat& frame) @@ -171,3 +172,4 @@ void Camera::camera_deleter::operator()(cv::VideoCapture* cap) } } +} // ns pt_module diff --git a/tracker-pt/module/frame.cpp b/tracker-pt/module/frame.cpp index 6734edf6..7dd8c92f 100644 --- a/tracker-pt/module/frame.cpp +++ b/tracker-pt/module/frame.cpp @@ -4,7 +4,7 @@ #include <opencv2/imgproc.hpp> -using namespace pt_module; +namespace pt_module { Preview& Preview::operator=(const pt_frame& frame_) { @@ -76,3 +76,5 @@ void Preview::ensure_size(cv::Mat& frame, int w, int h, int type) if (frame.cols != w || frame.rows != h) frame = cv::Mat(h, w, type); } + +} // ns pt_module diff --git a/tracker-pt/module/frame.hpp b/tracker-pt/module/frame.hpp index 49dde49e..d440bd67 100644 --- a/tracker-pt/module/frame.hpp +++ b/tracker-pt/module/frame.hpp @@ -5,6 +5,11 @@ #include <opencv2/core.hpp> #include <QImage> +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif + namespace pt_module { struct Frame final : pt_frame @@ -29,8 +34,11 @@ struct Preview final : pt_preview private: static void ensure_size(cv::Mat& frame, int w, int h, int type); - bool fresh = true; - cv::Mat frame_copy, frame_color, frame_out, frame_out2; + cv::Mat frame_copy, frame_out; }; } // ns pt_module + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif diff --git a/tracker-pt/module/module.cpp b/tracker-pt/module/module.cpp index 4731175a..f665face 100644 --- a/tracker-pt/module/module.cpp +++ b/tracker-pt/module/module.cpp @@ -12,7 +12,11 @@ static const QString module_name = "tracker-pt"; -using namespace pt_module; +#ifdef __clang__ +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif + +namespace pt_module { struct pt_module_traits final : pt_runtime_traits { @@ -54,13 +58,15 @@ struct dialog_pt : TrackerDialog_PT dialog_pt(); }; -// ns pt_module - -using namespace pt_module; - dialog_pt::dialog_pt() : TrackerDialog_PT(module_name) {} QString metadata_pt::name() { return tr("PointTracker 1.1"); } QIcon metadata_pt::icon() { return QIcon(":/Resources/Logo_IR.png"); } +} + +// ns pt_module + +using namespace pt_module; + OPENTRACK_DECLARE_TRACKER(tracker_pt, dialog_pt, metadata_pt) diff --git a/tracker-pt/module/module.hpp b/tracker-pt/module/module.hpp index 3afe8bc9..0b3f12cf 100644 --- a/tracker-pt/module/module.hpp +++ b/tracker-pt/module/module.hpp @@ -13,8 +13,8 @@ class OTR_GENERIC_EXPORT metadata_pt : public Metadata { Q_OBJECT - QString name(); - QIcon icon(); + QString name() override; + QIcon icon() override; }; } // ns pt_module diff --git a/tracker-pt/module/point_extractor.cpp b/tracker-pt/module/point_extractor.cpp index f8c37351..c0756a40 100644 --- a/tracker-pt/module/point_extractor.cpp +++ b/tracker-pt/module/point_extractor.cpp @@ -30,7 +30,6 @@ #include <QDebug> using namespace types; -using namespace pt_module; // meanshift code written by Michael Welter @@ -84,6 +83,8 @@ static cv::Vec2d MeanShiftIteration(const cv::Mat &frame_gray, const vec2 &curre return current_center; } +namespace pt_module { + PointExtractor::PointExtractor(const QString& module_name) : s(module_name) { blobs.reserve(max_blobs); @@ -352,7 +353,9 @@ end: const f overlay_size = dpi > 1.5 ? 2 : 1; - cv::circle(preview_frame, p, iround((b.radius + 3.3) * c_ * c_fract), circle_color, overlay_size, cv::LINE_AA, fract_bits); + cv::circle(preview_frame, p, iround((b.radius + 3.3) * c_ * c_fract), + circle_color, (int)overlay_size, + cv::LINE_AA, fract_bits); char buf[16]; buf[sizeof(buf)-1] = '\0'; @@ -387,3 +390,5 @@ blob::blob(f radius, const vec2& pos, f brightness, const cv::Rect& rect) : { //qDebug() << "radius" << radius << "pos" << pos[0] << pos[1]; } + +} // ns pt_module |