summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-15 09:54:35 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-03-15 09:55:16 +0100
commit62b952b9939940daf9c7132eb408d070c77eaf8d (patch)
tree3a778c109d13aa697f6d87e058a74b1f7dc2ca9d /tracker-pt
parent98536d936ab329ba78a8ad21a5608b449452cb02 (diff)
tracker/pt: fix logic error in camera reopen
- cap->isOpened() got its return value flipped in the conditional. - the stop(); return false block was in the wrong place
Diffstat (limited to 'tracker-pt')
-rw-r--r--tracker-pt/camera.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/tracker-pt/camera.cpp b/tracker-pt/camera.cpp
index 709ec612..68b0cf16 100644
--- a/tracker-pt/camera.cpp
+++ b/tracker-pt/camera.cpp
@@ -79,14 +79,12 @@ DEFUN_WARN_UNUSED bool Camera::start(int idx, int fps, int res_x, int res_y)
{
if (idx >= 0 && fps >= 0 && res_x > 0 && res_y > 0)
{
- if (!cap || cap->isOpened() ||
+ if (!cap || !cap->isOpened() ||
cam_desired.idx != idx ||
cam_desired.fps != fps ||
cam_desired.res_x != res_x ||
cam_desired.res_y != res_y)
{
- qDebug() << "pt: opening camera";
-
cam_desired.idx = idx;
cam_desired.fps = fps;
cam_desired.res_x = res_x;
@@ -100,16 +98,23 @@ DEFUN_WARN_UNUSED bool Camera::start(int idx, int fps, int res_x, int res_y)
if (cap->isOpened())
{
+ qDebug() << "pt: opening camera";
+
cam_info = CamInfo();
cam_info.idx = cam_desired.idx;
active_name = desired_name;
return true;
}
+ else
+ {
+ stop();
+ return false;
+ }
}
}
- return stop(), false;
+ return true;
}
void Camera::stop()
@@ -141,7 +146,7 @@ void Camera::camera_deleter::operator()(cv::VideoCapture* cap)
{
if (cap->isOpened())
cap->release();
- std::default_delete<cv::VideoCapture>()(cap);
+ delete cap;
}
}