summaryrefslogtreecommitdiffhomepage
path: root/tracker-aruco/ftnoir_tracker_aruco.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-12-03 07:10:12 +0100
committerStanislaw Halik <sthalik@misaki.pl>2016-12-03 07:10:12 +0100
commitac36fa53e970bf79d68499b52433d33ed994c4c5 (patch)
treeb98ad2b555c8b16ab108ff77be6c1ea063606e0e /tracker-aruco/ftnoir_tracker_aruco.cpp
parent1aeb193a0277e2f1319dd1e935f8111cf01d301c (diff)
tracker/{aruco,pt}: use RAII for QObject
Diffstat (limited to 'tracker-aruco/ftnoir_tracker_aruco.cpp')
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp
index 0df89fcb..5473eb6f 100644
--- a/tracker-aruco/ftnoir_tracker_aruco.cpp
+++ b/tracker-aruco/ftnoir_tracker_aruco.cpp
@@ -42,15 +42,13 @@ constexpr const double aruco_tracker::size_min;
constexpr const double aruco_tracker::size_max;
aruco_tracker::aruco_tracker() :
- stop(false),
- layout(nullptr),
- videoWidget(nullptr),
fps(0),
obj_points(4),
intrinsics(cv::Matx33d::eye()),
rmat(cv::Matx33d::eye()),
roi_points(4),
- last_roi(65535, 65535, 0, 0)
+ last_roi(65535, 65535, 0, 0),
+ stop(false)
{
// param 2 ignored for Otsu thresholding. it's required to use our fork of Aruco.
detector.setThresholdParams(7, -1);
@@ -62,10 +60,6 @@ aruco_tracker::~aruco_tracker()
{
stop = true;
wait();
- if (videoWidget)
- delete videoWidget;
- if(layout)
- delete layout;
// fast start/stop causes breakage
portable::sleep(1000);
camera.release();
@@ -74,18 +68,15 @@ aruco_tracker::~aruco_tracker()
void aruco_tracker::start_tracker(QFrame* videoframe)
{
videoframe->show();
- videoWidget = new cv_video_widget(videoframe);
- QHBoxLayout* layout_ = new QHBoxLayout();
- layout_->setContentsMargins(0, 0, 0, 0);
- layout_->addWidget(videoWidget);
- if (videoframe->layout())
- delete videoframe->layout();
- videoframe->setLayout(layout_);
+ videoWidget = qptr<cv_video_widget>(videoframe);
+ layout = qptr<QHBoxLayout>();
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(videoWidget.data());
+ videoframe->setLayout(layout.data());
videoWidget->show();
start();
for (int i = 0; i < 6; i++)
pose[i] = 0;
- layout = layout_;
}
void aruco_tracker::getRT(cv::Matx33d& r_, cv::Vec3d& t_)