add input paramter checking that verifies the existance of the input files to stero_match example

This commit is contained in:
Brian Park 2014-10-21 22:47:49 -07:00
parent e40567eaee
commit f83a76cdeb

View File

@ -14,6 +14,7 @@
#include "opencv2/core/utility.hpp"
#include <stdio.h>
#include <sys/stat.h>
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");