From 0bfc42544b48a450cb6e332432c112cbc00a56df Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Mon, 20 Aug 2018 08:08:50 +0100 Subject: [PATCH] Not calling waitKey if no output is shown. --- .travis.yml | 2 +- lib/local/Utilities/src/Visualizer.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 19d372af7..82c7748b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ branches: only: - master - develop - - feature/travis_fixes + - feature/no-ui-fix compiler: - gcc diff --git a/lib/local/Utilities/src/Visualizer.cpp b/lib/local/Utilities/src/Visualizer.cpp index 2341e140b..ac2ca611b 100644 --- a/lib/local/Utilities/src/Visualizer.cpp +++ b/lib/local/Utilities/src/Visualizer.cpp @@ -418,23 +418,37 @@ void Visualizer::SetFps(double fps) char Visualizer::ShowObservation() { + bool ovservation_shown = false; + if (vis_align && !aligned_face_image.empty()) { cv::imshow("sim_warp", aligned_face_image); + ovservation_shown = true; } if (vis_hog && !hog_image.empty()) { cv::imshow("hog", hog_image); + ovservation_shown = true; } if (vis_aus && !action_units_image.empty()) { cv::imshow("action units", action_units_image); + ovservation_shown = true; } if (vis_track) { cv::imshow("tracking result", captured_image); + ovservation_shown = true; + } + + // Only perform waitKey if something was shown + char result = '\0'; + if (ovservation_shown) + { + result = cv::waitKey(1); } - return cv::waitKey(1); + return result; + } cv::Mat Visualizer::GetVisImage()