diff options
-rw-r--r-- | tracker-aruco/ftnoir_tracker_aruco.cpp | 4 | ||||
-rw-r--r-- | tracker-easy/tracker-easy.cpp | 8 | ||||
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 3 |
3 files changed, 12 insertions, 3 deletions
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index d9cb2b96..bdb41d44 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -164,6 +164,10 @@ bool aruco_tracker::open_camera() QMutexLocker l(&camera_mtx); camera = video::make_camera(s.camera_name); + + if (!camera) + return false; + video::impl::camera::info args {}; if (res.width) diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp index 0217b07f..dd96e782 100644 --- a/tracker-easy/tracker-easy.cpp +++ b/tracker-easy/tracker-easy.cpp @@ -729,6 +729,12 @@ namespace EasyTracker return module_status("Error: Solver not supported use either P3P or AP3P."); } + // Create our camera + camera = video::make_camera(iSettings.camera_name); + + if (!camera) + return error(QStringLiteral("Can't open camera %1").arg(iSettings.camera_name)); + //video_frame->setAttribute(Qt::WA_NativeWindow); widget = std::make_unique<video_widget>(video_frame); layout = std::make_unique<QHBoxLayout>(video_frame); @@ -738,8 +744,6 @@ namespace EasyTracker //video_widget->resize(video_frame->width(), video_frame->height()); video_frame->show(); - // Create our camera - camera = video::make_camera(iSettings.camera_name); // Precise timer is needed otherwise the interval is not really respected iTicker.setTimerType(Qt::PreciseTimer); SetFps(iSettings.cam_fps); diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index ea5346f6..194fd423 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -53,7 +53,8 @@ void Tracker_PT::run() { portable::set_curthread_name("tracker/pt"); - maybe_reopen_camera(); + if (!maybe_reopen_camera()) + return; while(!isInterruptionRequested()) { |