diff options
-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. |