From 1d92c1663dce28e8806ef0aca285d7d7329bd571 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 28 Mar 2014 12:41:47 -0500 Subject: [PATCH] Added check to verify that file exists when input is given on standard in. If not, print an error message --- src/main.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 53e1cd2..2e9d8c7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -116,8 +116,16 @@ int main( int argc, const char** argv ) std::string filename; while (std::getline(std::cin, filename)) { - frame = cv::imread( filename ); - detectandshow( &alpr, frame, "", outputJson); + if (fileExists(filename.c_str())) + { + frame = cv::imread( filename ); + detectandshow( &alpr, frame, "", outputJson); + } + else + { + std::cerr << "Image file not found: " << filename << std::endl; + } + } } else if (filename == "webcam")