#include #include #include using namespace std; using namespace cv; inline bool file_exists (const std::string& name) { struct stat buffer; return (stat (name.c_str(), &buffer) == 0); } int main(int argc, char** argv) { string input; if (argc == 2) { input = argv[1]; } else if (argc < 2) { cerr << "Please provide one image." << endl; return -1; } else if (argc > 2) { cerr << "Please provide only one image." << endl; return -2; } if (!file_exists(input)) { cerr << "File " << input << " does not exist." << endl; return -3; } cout << "Using image " << input << "." << endl; return 0; }