Added error message when input image/video file is not found

This commit is contained in:
Matt Hill
2014-02-17 14:57:14 -06:00
parent 3bc2d43929
commit a07991adb6

View File

@@ -20,6 +20,7 @@
#include <iostream>
#include <valarray>
#include <stdio.h>
#include <sys/stat.h>
@@ -138,6 +139,8 @@
}
}
else if (hasEnding(filename, ".avi") || hasEnding(filename, ".mp4") || hasEnding(filename, ".webm") || hasEnding(filename, ".flv"))
{
if (fileExists(filename.c_str()))
{
int framenum = 0;
@@ -158,13 +161,25 @@
cv::waitKey(1);
framenum++;
}
}
else
{
std::cerr << "Video file not found: " << filename << std::endl;
}
}
else if (hasEnding(filename, ".png") || hasEnding(filename, ".jpg") || hasEnding(filename, ".gif"))
{
if (fileExists(filename.c_str()))
{
frame = cv::imread( filename );
detectandshow( &alpr, frame, "", outputJson);
}
else
{
std::cerr << "Image file not found: " << filename << std::endl;
}
}