From 6cd2332a806013108322776d696fe34429dcd815 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 24 Nov 2013 06:54:00 +0100 Subject: fix osx brain damage by moving camera close to gui thread --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 9 ++++----- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 0d93dba5..41bf0edd 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -148,6 +148,9 @@ Tracker::~Tracker() delete videoWidget; if(layout) delete layout; + qDebug() << "releasing camera, brace for impact"; + camera.release(); + qDebug() << "all done!"; } void Tracker::StartTracker(QFrame* videoframe) @@ -172,8 +175,7 @@ void Tracker::StartTracker(QFrame* videoframe) void Tracker::run() { - cv::VideoCapture camera(camera_index); - + camera = cv::VideoCapture(camera_index); if (force_width) camera.set(CV_CAP_PROP_FRAME_WIDTH, force_width); if (force_height) @@ -354,9 +356,6 @@ void Tracker::run() if (frame.rows > 0) videoWidget->update_image(frame); } - qDebug() << "releasing camera, brace for impact"; - camera.release(); - qDebug() << "all done!"; } bool Tracker::GiveHeadPoseData(double *data) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 097c91e1..3a2ebeea 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -17,6 +17,7 @@ #include #include #include +#include class Tracker : protected QThread, public ITracker { @@ -40,6 +41,7 @@ private: double pose[6]; cv::Mat frame; double headpos[3]; + cv::VideoCapture camera; }; // Widget that has controls for FTNoIR protocol client-settings. -- cgit v1.2.3