diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-24 06:54:00 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-24 06:54:00 +0100 |
commit | 6cd2332a806013108322776d696fe34429dcd815 (patch) | |
tree | c7ca23427393d7c0176a40f5a60c5a2bd9b4f7cb /ftnoir_tracker_aruco | |
parent | 60a79a5b244dbe9cc51fb5ee6fe784ccb374e917 (diff) |
fix osx brain damage by moving camera close to gui thread
Diffstat (limited to 'ftnoir_tracker_aruco')
-rw-r--r-- | ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 9 | ||||
-rw-r--r-- | ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 |
2 files changed, 6 insertions, 5 deletions
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 <QHBoxLayout> #include <QDialog> #include <opencv2/opencv.hpp> +#include <opencv/highgui.h> 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. |