summaryrefslogtreecommitdiffhomepage
path: root/tracker-easy
diff options
context:
space:
mode:
authorStéphane Lenclud <github@lenclud.com>2019-04-16 18:01:57 +0200
committerStéphane Lenclud <github@lenclud.com>2019-04-24 18:46:12 +0200
commitbe51a114bca4f3f43ed88001cdc510ccf246079f (patch)
treeac0b3b4f2a3b7091cb4657a422469e13716e380c /tracker-easy
parent1fb6122dce1a5bc117e925006d87828a52cfecb6 (diff)
Easy Tracker: Mostly code clean-up.
Diffstat (limited to 'tracker-easy')
-rw-r--r--tracker-easy/tracker-easy.cpp26
-rw-r--r--tracker-easy/tracker-easy.h10
2 files changed, 21 insertions, 15 deletions
diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp
index 68e3be36..4afb928a 100644
--- a/tracker-easy/tracker-easy.cpp
+++ b/tracker-easy/tracker-easy.cpp
@@ -36,17 +36,17 @@ namespace EasyTracker
{
Tracker::Tracker() :
- s{ KModuleName },
+ iSettings{ KModuleName },
iPreview{ preview_width, preview_height }
{
cv::setBreakOnError(true);
cv::setNumThreads(1);
- connect(s.b.get(), &bundle_::saving, this, &Tracker::maybe_reopen_camera, Qt::DirectConnection);
- connect(s.b.get(), &bundle_::reloading, this, &Tracker::maybe_reopen_camera, Qt::DirectConnection);
+ connect(iSettings.b.get(), &bundle_::saving, this, &Tracker::maybe_reopen_camera, Qt::DirectConnection);
+ connect(iSettings.b.get(), &bundle_::reloading, this, &Tracker::maybe_reopen_camera, Qt::DirectConnection);
- connect(&s.fov, value_::value_changed<int>(), this, &Tracker::set_fov, Qt::DirectConnection);
- set_fov(s.fov);
+ connect(&iSettings.fov, value_::value_changed<int>(), this, &Tracker::set_fov, Qt::DirectConnection);
+ set_fov(iSettings.fov);
CreateModelFromSettings();
}
@@ -92,8 +92,8 @@ namespace EasyTracker
// TODO: Need to support clip too. That's cap only for now.
// s.active_model_panel != PointModel::Clip
iModel.clear();
- iModel.push_back(cv::Point3f(s.cap_x / 10.0, s.cap_z / 10.0, -s.cap_y / 10.0)); // Right
- iModel.push_back(cv::Point3f(-s.cap_x / 10.0, s.cap_z / 10.0, -s.cap_y / 10.0)); // Left
+ iModel.push_back(cv::Point3f(iSettings.cap_x / 10.0, iSettings.cap_z / 10.0, -iSettings.cap_y / 10.0)); // Right
+ iModel.push_back(cv::Point3f(-iSettings.cap_x / 10.0, iSettings.cap_z / 10.0, -iSettings.cap_y / 10.0)); // Left
iModel.push_back(cv::Point3f(0, 0, 0)); // Top
}
@@ -286,7 +286,7 @@ namespace EasyTracker
}
// Show full size preview pop-up
- if (s.debug)
+ if (iSettings.debug)
{
cv::imshow("Preview", iPreview.iFrameRgb);
cv::waitKey(1);
@@ -306,7 +306,7 @@ namespace EasyTracker
else
{
// No preview, destroy preview pop-up
- if (s.debug)
+ if (iSettings.debug)
{
cv::destroyWindow("Preview");
}
@@ -345,9 +345,9 @@ namespace EasyTracker
return true;
}
- iCameraInfo.fps = s.cam_fps;
- iCameraInfo.width = s.cam_res_x;
- iCameraInfo.height = s.cam_res_y;
+ iCameraInfo.fps = iSettings.cam_fps;
+ iCameraInfo.width = iSettings.cam_res_x;
+ iCameraInfo.height = iSettings.cam_res_y;
bool res = camera->start(iCameraInfo);
// We got new our camera intrinsics, create corresponding matrices
@@ -374,7 +374,7 @@ namespace EasyTracker
video_frame->show();
// Create our camera
- camera = video::make_camera(s.camera_name);
+ camera = video::make_camera(iSettings.camera_name);
start(QThread::HighPriority);
diff --git a/tracker-easy/tracker-easy.h b/tracker-easy/tracker-easy.h
index 257dd6ca..06551533 100644
--- a/tracker-easy/tracker-easy.h
+++ b/tracker-easy/tracker-easy.h
@@ -39,11 +39,16 @@ namespace EasyTracker
struct Tracker : QThread, ITracker
{
- public:
+ // We had problem where Qt slots would not get disconnected upon object destruction.
+ // Issue seems to be gone now even without Q_OBJECT declaration, go figure.
+ //Q_OBJECT
+ public:
friend class Dialog;
explicit Tracker();
~Tracker() override;
+
+ // From ITracker
module_status start_tracker(QFrame* parent_window) override;
void data(double* data) override;
bool center() override;
@@ -52,6 +57,7 @@ namespace EasyTracker
void CreateModelFromSettings();
void CreateCameraIntrinsicsMatrices();
+ // From QThread
void run() override;
bool maybe_reopen_camera();
@@ -60,7 +66,7 @@ namespace EasyTracker
QMutex camera_mtx;
- Settings s;
+ Settings iSettings;
std::unique_ptr<QLayout> layout;
std::vector<cv::Point> iPoints;