Skip to content

Commit ddbd074

Browse files
committed
samples: check for valid input in gpu/super_resolution.cpp
1 parent b1ed8bc commit ddbd074

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

samples/gpu/super_resolution.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static Ptr<cv::superres::DenseOpticalFlowExt> createOptFlow(const string& name,
5555
int main(int argc, const char* argv[])
5656
{
5757
CommandLineParser cmd(argc, argv,
58-
"{ v video | | Input video }"
58+
"{ v video | | Input video (mandatory)}"
5959
"{ o output | | Output video }"
6060
"{ s scale | 4 | Scale factor }"
6161
"{ i iterations | 180 | Iteration count }"
@@ -65,14 +65,14 @@ int main(int argc, const char* argv[])
6565
"{ h help | false | Print help message }"
6666
);
6767

68-
if (cmd.get<bool>("help"))
68+
const string inputVideoName = cmd.get<string>("video");
69+
if (cmd.get<bool>("help") || inputVideoName.empty())
6970
{
7071
cout << "This sample demonstrates Super Resolution algorithms for video sequence" << endl;
7172
cmd.printMessage();
7273
return EXIT_SUCCESS;
7374
}
7475

75-
const string inputVideoName = cmd.get<string>("video");
7676
const string outputVideoName = cmd.get<string>("output");
7777
const int scale = cmd.get<int>("scale");
7878
const int iterations = cmd.get<int>("iterations");

0 commit comments

Comments
 (0)