Commit f83a76cd authored by Brian Park's avatar Brian Park

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

parent e40567ea
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "opencv2/core/utility.hpp" #include "opencv2/core/utility.hpp"
#include <stdio.h> #include <stdio.h>
#include <sys/stat.h>
using namespace cv; using namespace cv;
...@@ -143,6 +144,19 @@ int main(int argc, char** argv) ...@@ -143,6 +144,19 @@ int main(int argc, char** argv)
return -1; 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) ) 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"); 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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment