From: Brian Park Date: Wed, 22 Oct 2014 05:47:49 +0000 (-0700) Subject: add input paramter checking that verifies the existance of the input files to stero_m... X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~2843^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f83a76cdebee199cd921fa7749ead1c52e78f2eb;p=platform%2Fupstream%2Fopencv.git add input paramter checking that verifies the existance of the input files to stero_match example --- diff --git a/samples/cpp/stereo_match.cpp b/samples/cpp/stereo_match.cpp index f5f77cf..ad4670f 100644 --- a/samples/cpp/stereo_match.cpp +++ b/samples/cpp/stereo_match.cpp @@ -14,6 +14,7 @@ #include "opencv2/core/utility.hpp" #include +#include using namespace cv; @@ -143,6 +144,19 @@ int main(int argc, char** argv) return -1; } + struct stat stat_buffer; + if (stat(img1_filename, &stat_buffer) != 0) + { + printf("Command-line parameter error: could not find the first input image file\n"); + return -1; + } + + if (stat(img2_filename, &stat_buffer) != 0) + { + printf("Command-line parameter error: could not find the second input image file\n"); + return -1; + } + if( (intrinsic_filename != 0) ^ (extrinsic_filename != 0) ) { printf("Command-line parameter error: either both intrinsic and extrinsic parameters must be specified, or none of them (when the stereo pair is already rectified)\n");