From e9b42b3d4eabd1d4fbcdfb990c26f286259be8d2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 20 Jul 2015 08:09:44 +0200 Subject: camera: more robust get_info() If camera was barely created and there's no info, grab the first frame to get resolution data. --- ftnoir_tracker_pt/camera.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ftnoir_tracker_pt/camera.cpp') diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index 9168a3e4..2e745f2a 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -61,6 +61,16 @@ void Camera::set_res(int x_res, int y_res) } } +CamInfo Camera::get_info() +{ + if (cam_info.res_x == 0 || cam_info.res_y == 0) + { + cv::Mat tmp; + _get_frame(&tmp); + } + return cam_info; +} + bool Camera::get_frame(float dt, cv::Mat* frame) { bool new_frame = _get_frame(frame); -- cgit v1.2.3