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

pull/3357/head
Brian Park 10 years ago
parent e40567eaee
commit f83a76cdeb
  1. 14
      samples/cpp/stereo_match.cpp

@ -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");

Loading…
Cancel
Save