From 044de4105e809f7380e461588757fce6628eab1c Mon Sep 17 00:00:00 2001 From: Brian Park Date: Tue, 21 Oct 2014 22:47:49 -0700 Subject: [PATCH] add input paramter checking that verifies the existance of the input files to stero_match example remove the unnecessary header file check input paramter by checking the image size --- samples/cpp/stereo_match.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/samples/cpp/stereo_match.cpp b/samples/cpp/stereo_match.cpp index 69c77c39a3..9dc448abd3 100644 --- a/samples/cpp/stereo_match.cpp +++ b/samples/cpp/stereo_match.cpp @@ -159,7 +159,18 @@ int main(int argc, char** argv) Mat img1 = imread(img1_filename, color_mode); Mat img2 = imread(img2_filename, color_mode); - if( scale != 1.f ) + if (img1.empty()) + { + printf("Command-line parameter error: could not load the first input image file\n"); + return -1; + } + if (img2.empty()) + { + printf("Command-line parameter error: could not load the second input image file\n"); + return -1; + } + + if (scale != 1.f) { Mat temp1, temp2; int method = scale < 1 ? INTER_AREA : INTER_CUBIC;