From 2e3cb52cff46f5990e88aa3223e39e96df4c8702 Mon Sep 17 00:00:00 2001 From: Micaela Verucchi Date: Mon, 11 May 2020 15:08:10 +0200 Subject: [PATCH] Add flag to disable visualization and save video Signed-off-by: Micaela Verucchi --- demo/demo/demo.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/demo/demo/demo.cpp b/demo/demo/demo.cpp index 75012b6..540ee25 100644 --- a/demo/demo/demo.cpp +++ b/demo/demo/demo.cpp @@ -34,6 +34,12 @@ int main(int argc, char *argv[]) { int n_classes = 80; if(argc > 4) n_classes = atoi(argv[4]); + bool show = true; + if(argc > 5) + show = atoi(argv[5]); + + if(!show) + SAVE_RESULT = true; tk::dnn::Yolo3Detection yolo; tk::dnn::CenternetDetection cnet; @@ -76,7 +82,8 @@ int main(int argc, char *argv[]) { cv::Mat frame; cv::Mat dnn_input; - cv::namedWindow("detection", cv::WINDOW_NORMAL); + if(show) + cv::namedWindow("detection", cv::WINDOW_NORMAL); std::vector detected_bbox; @@ -93,8 +100,10 @@ int main(int argc, char *argv[]) { detNN->update(dnn_input); frame = detNN->draw(frame); - cv::imshow("detection", frame); - cv::waitKey(1); + if(show){ + cv::imshow("detection", frame); + cv::waitKey(1); + } if(SAVE_RESULT) resultVideo << frame; }