summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-01 20:35:46 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-03-01 20:35:46 +0100
commitc05bce7e3df9ae7ef853af9dfc87d98856ba161c (patch)
tree870056a9f9ef2fb02398253cc5a9805eebd34088 /tracker-pt
parent576319ef9d04ef48982bf9ebc0d5e9c84cfc45ca (diff)
tracker/pt: simplify camera frame retry logic
Diffstat (limited to 'tracker-pt')
-rw-r--r--tracker-pt/camera.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/tracker-pt/camera.cpp b/tracker-pt/camera.cpp
index 89854cc7..709ec612 100644
--- a/tracker-pt/camera.cpp
+++ b/tracker-pt/camera.cpp
@@ -125,13 +125,12 @@ DEFUN_WARN_UNUSED bool Camera::_get_frame(cv::Mat& frame)
{
if (cap && cap->isOpened())
{
- for (int i = 0; i < 5 && !cap->read(frame); i++)
+ for (int i = 0; i < 5; i++)
+ {
+ if (cap->read(frame))
+ return true;
portable::sleep(100);
-
- if (frame.empty())
- return false;
-
- return true;
+ }
}
return false;
}