diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-22 02:55:16 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-22 02:55:16 +0100 |
commit | 8c762f5143efe2cc3437ae5b3d8d5159c6593957 (patch) | |
tree | f413685afd79df20658ac32533e5fbafd67d8aa0 /ftnoir_tracker_aruco | |
parent | 8a3e9c35142c115188b03aa4d73117a8f12e3175 (diff) |
hopefully fix aruco crash on exit
Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
Diffstat (limited to 'ftnoir_tracker_aruco')
-rw-r--r-- | ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index a4c521d0..2fdd1014 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -178,14 +178,14 @@ void Tracker::run() { start: reset = false; - std::unique_ptr<cv::VideoCapture> camera(new cv::VideoCapture(camera_index)); + cv::VideoCapture camera(camera_index); if (force_width) - camera->set(CV_CAP_PROP_FRAME_WIDTH, force_width); + camera.set(CV_CAP_PROP_FRAME_WIDTH, force_width); if (force_height) - camera->set(CV_CAP_PROP_FRAME_HEIGHT, force_height); + camera.set(CV_CAP_PROP_FRAME_HEIGHT, force_height); if (force_fps) - camera->set(CV_CAP_PROP_FPS, force_fps); + camera.set(CV_CAP_PROP_FPS, force_fps); aruco::MarkerDetector detector; detector.setDesiredSpeed(3); @@ -197,14 +197,14 @@ start: const double stateful_coeff = 0.81; - if (!camera->isOpened()) + if (!camera.isOpened()) { fprintf(stderr, "aruco tracker: can't open camera\n"); return; } while (!stop) - if(camera->read(color_)) + if(camera.read(color_)) break; auto freq = cv::getTickFrequency(); @@ -216,10 +216,9 @@ start: { if (reset) { - camera.reset(nullptr); goto start; } - if (!camera->read(color_)) + if (!camera.read(color_)) continue; auto tm = cv::getTickCount(); color_.copyTo(color); |