From 496fda510969441a873160b20e297beac046be20 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 12 Oct 2018 19:07:54 +0200 Subject: tracker/pt: add more robust camera retry Some cameras can't produce frames right after the capture is opened. Adjust the delay to something more sane. It has a strange effect of not crashing PS3 Eye as often, but that needs more testing (and crashes). --- tracker-pt/module/camera.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tracker-pt/module/camera.cpp b/tracker-pt/module/camera.cpp index 14b565b6..e2edfcb6 100644 --- a/tracker-pt/module/camera.cpp +++ b/tracker-pt/module/camera.cpp @@ -151,11 +151,11 @@ bool Camera::_get_frame(cv::Mat& frame) { if (cap && cap->isOpened()) { - for (int i = 0; i < 5; i++) + for (unsigned i = 0; i < 10; i++) { if (cap->read(frame)) return true; - portable::sleep(1); + portable::sleep(50); } } return false; -- cgit v1.2.3