From ddbd07467849f01b40c8d49fecc131ab3b4b7a67 Mon Sep 17 00:00:00 2001 From: berak Date: Fri, 22 Dec 2017 12:34:25 +0100 Subject: [PATCH] samples: check for valid input in gpu/super_resolution.cpp --- samples/gpu/super_resolution.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/gpu/super_resolution.cpp b/samples/gpu/super_resolution.cpp index 2ff66ea..a05b901 100644 --- a/samples/gpu/super_resolution.cpp +++ b/samples/gpu/super_resolution.cpp @@ -55,7 +55,7 @@ static Ptr createOptFlow(const string& name, int main(int argc, const char* argv[]) { CommandLineParser cmd(argc, argv, - "{ v video | | Input video }" + "{ v video | | Input video (mandatory)}" "{ o output | | Output video }" "{ s scale | 4 | Scale factor }" "{ i iterations | 180 | Iteration count }" @@ -65,14 +65,14 @@ int main(int argc, const char* argv[]) "{ h help | false | Print help message }" ); - if (cmd.get("help")) + const string inputVideoName = cmd.get("video"); + if (cmd.get("help") || inputVideoName.empty()) { cout << "This sample demonstrates Super Resolution algorithms for video sequence" << endl; cmd.printMessage(); return EXIT_SUCCESS; } - const string inputVideoName = cmd.get("video"); const string outputVideoName = cmd.get("output"); const int scale = cmd.get("scale"); const int iterations = cmd.get("iterations"); -- 2.7.4