summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-06-22 12:54:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-06-26 23:01:53 +0200
commitf50ac3549d6a7f1199fa012e4b03f581bc8d305b (patch)
tree50ff044f1c618119c88544709808f533ed02225e /tracker-pt
parentd61eb905ae3fa161d50821d01ee47915713e89c2 (diff)
core, modules: modernize syntax only
Use more C++17 features where this helps any.
Diffstat (limited to 'tracker-pt')
-rw-r--r--tracker-pt/ftnoir_tracker_pt.cpp5
-rw-r--r--tracker-pt/ftnoir_tracker_pt.h12
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.cpp31
-rw-r--r--tracker-pt/pt-api.hpp3
-rw-r--r--tracker-pt/pt-settings.hpp2
5 files changed, 24 insertions, 29 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp
index 243fbd60..e6cbb6ba 100644
--- a/tracker-pt/ftnoir_tracker_pt.cpp
+++ b/tracker-pt/ftnoir_tracker_pt.cpp
@@ -7,6 +7,7 @@
*/
#include "ftnoir_tracker_pt.h"
+#include "cv/video-widget.hpp"
#include "compat/camera-names.hpp"
#include "compat/math-imports.hpp"
@@ -14,8 +15,6 @@
#include <cmath>
-#include <opencv2/imgproc.hpp>
-
#include <QHBoxLayout>
#include <QDebug>
#include <QFile>
@@ -23,7 +22,7 @@
using namespace types;
-Tracker_PT::Tracker_PT(pointer<pt_runtime_traits> traits) :
+Tracker_PT::Tracker_PT(pointer<pt_runtime_traits> const& traits) :
traits { traits },
s { traits->get_module_name() },
point_extractor { traits->make_point_extractor() },
diff --git a/tracker-pt/ftnoir_tracker_pt.h b/tracker-pt/ftnoir_tracker_pt.h
index 489175e4..31bdc6bb 100644
--- a/tracker-pt/ftnoir_tracker_pt.h
+++ b/tracker-pt/ftnoir_tracker_pt.h
@@ -9,12 +9,9 @@
#pragma once
#include "api/plugin-api.hpp"
-
-#include "cv/numeric.hpp"
-
#include "pt-api.hpp"
#include "point_tracker.h"
-#include "cv/video-widget.hpp"
+#include "cv/numeric.hpp"
#include <atomic>
#include <memory>
@@ -25,9 +22,9 @@
#include <QThread>
#include <QMutex>
#include <QLayout>
-#include <QTimer>
class TrackerDialog_PT;
+class cv_video_widget;
namespace pt_module {
@@ -40,10 +37,9 @@ class Tracker_PT : public QThread, public ITracker
friend class ::TrackerDialog_PT;
public:
- template<typename t>
- using pointer = typename pt_runtime_traits::pointer<t>;
+ template<typename t> using pointer = pt_pointer<t>;
- Tracker_PT(pointer<pt_runtime_traits> pt_runtime_traits);
+ Tracker_PT(pointer<pt_runtime_traits> const& pt_runtime_traits);
~Tracker_PT() override;
module_status start_tracker(QFrame* parent_window) override;
void data(double* data) override;
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
index 9073907d..ce1b9eb0 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
@@ -165,18 +165,16 @@ void TrackerDialog_PT::startstop_trans_calib(bool start)
// Don't bother counting roll samples. Roll calibration is hard enough
// that it's a hidden unsupported feature anyway.
- const QString sample_feedback = progn(
- if (nsamples[0] < min_yaw_samples)
- return tr("%1 yaw samples. Yaw more to %2 samples for stable calibration.")
- .arg(nsamples[0]).arg(min_yaw_samples);
- if (nsamples[1] < min_pitch_samples)
- return tr("%1 pitch samples. Pitch more to %2 samples for stable calibration.")
- .arg(nsamples[1]).arg(min_pitch_samples);
-
+ QString sample_feedback;
+ if (nsamples[0] < min_yaw_samples)
+ sample_feedback = tr("%1 yaw samples. Yaw more to %2 samples for stable calibration.").arg(nsamples[0]).arg(min_yaw_samples);
+ else if (nsamples[1] < min_pitch_samples)
+ sample_feedback = tr("%1 pitch samples. Pitch more to %2 samples for stable calibration.").arg(nsamples[1]).arg(min_pitch_samples);
+ else
+ {
const int nsamples_total = nsamples[0] + nsamples[1];
-
- return tr("%1 samples. Over %2, good!").arg(nsamples_total).arg(min_samples);
- );
+ sample_feedback = tr("%1 samples. Over %2, good!").arg(nsamples_total).arg(min_samples);
+ }
ui.sample_count_display->setText(sample_feedback);
}
@@ -184,12 +182,11 @@ void TrackerDialog_PT::startstop_trans_calib(bool start)
ui.tx_spin->setEnabled(!start);
ui.ty_spin->setEnabled(!start);
ui.tz_spin->setEnabled(!start);
- ui.tcalib_button->setText(progn(
- if (start)
- return tr("Stop calibration");
- else
- return tr("Start calibration");
- ));
+
+ if (start)
+ ui.tcalib_button->setText(tr("Stop calibration"));
+ else
+ ui.tcalib_button->setText(tr("Start calibration"));
}
void TrackerDialog_PT::poll_tracker_info_impl()
diff --git a/tracker-pt/pt-api.hpp b/tracker-pt/pt-api.hpp
index 621d9160..7ddddaf5 100644
--- a/tracker-pt/pt-api.hpp
+++ b/tracker-pt/pt-api.hpp
@@ -107,3 +107,6 @@ struct pt_runtime_traits
virtual pointer<pt_preview> make_preview(int w, int h) const = 0;
virtual QString get_module_name() const = 0;
};
+
+template<typename t>
+using pt_pointer = typename pt_runtime_traits::pointer<t>;
diff --git a/tracker-pt/pt-settings.hpp b/tracker-pt/pt-settings.hpp
index a1b9d4f6..a8e3497a 100644
--- a/tracker-pt/pt-settings.hpp
+++ b/tracker-pt/pt-settings.hpp
@@ -52,5 +52,5 @@ struct pt_settings final : options::opts
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", slider_value(128, 0, 255) };
+ value<slider_value> threshold_slider { b, "threshold-slider", { 128, 0, 255 } };
};