Added check to verify that file exists when input is given on standard in. If not, print an error message

This commit is contained in:
Matt Hill
2014-03-28 12:41:47 -05:00
parent d18e0e23b0
commit 1d92c1663d

View File

@@ -116,8 +116,16 @@ int main( int argc, const char** argv )
std::string filename; std::string filename;
while (std::getline(std::cin, filename)) while (std::getline(std::cin, filename))
{ {
frame = cv::imread( filename ); if (fileExists(filename.c_str()))
detectandshow( &alpr, frame, "", outputJson); {
frame = cv::imread( filename );
detectandshow( &alpr, frame, "", outputJson);
}
else
{
std::cerr << "Image file not found: " << filename << std::endl;
}
} }
} }
else if (filename == "webcam") else if (filename == "webcam")