Commit 38904c9a authored by Adrien BAK's avatar Adrien BAK

fix exception being thrown when no arguments are passed

parent 094d7c49
...@@ -16,6 +16,7 @@ namespace ...@@ -16,6 +16,7 @@ namespace
const std::string windowName = "Hough Circle Detection Demo"; const std::string windowName = "Hough Circle Detection Demo";
const std::string cannyThresholdTrackbarName = "Canny threshold"; const std::string cannyThresholdTrackbarName = "Canny threshold";
const std::string accumulatorThresholdTrackbarName = "Accumulator Threshold"; const std::string accumulatorThresholdTrackbarName = "Accumulator Threshold";
const std::string usage = "Usage : tutorial_HoughCircle_Demo <path_to_input_image>\n";
// initial and max values of the parameters of interests. // initial and max values of the parameters of interests.
const int cannyThresholdInitialValue = 200; const int cannyThresholdInitialValue = 200;
...@@ -48,17 +49,24 @@ namespace ...@@ -48,17 +49,24 @@ namespace
} }
int main(int, char** argv) int main(int argc, char** argv)
{ {
Mat src, src_gray; Mat src, src_gray;
if (argc < 2)
{
std::cerr<<"No input image specified\n";
std::cout<<usage;
return -1;
}
// Read the image // Read the image
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
if( !src.data ) if( !src.data )
{ {
std::cerr<<"Invalid input image\n"; std::cerr<<"Invalid input image\n";
std::cout<<"Usage : tutorial_HoughCircle_Demo <path_to_input_image>\n"; std::cout<<usage;
return -1; return -1;
} }
......
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