mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
fix exception being thrown when no arguments are passed
This commit is contained in:
parent
094d7c4926
commit
38904c9a11
@ -16,6 +16,7 @@ namespace
|
||||
const std::string windowName = "Hough Circle Detection Demo";
|
||||
const std::string cannyThresholdTrackbarName = "Canny 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.
|
||||
const int cannyThresholdInitialValue = 200;
|
||||
@ -48,17 +49,24 @@ namespace
|
||||
}
|
||||
|
||||
|
||||
int main(int, char** argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
Mat src, src_gray;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
std::cerr<<"No input image specified\n";
|
||||
std::cout<<usage;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Read the image
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
if( !src.data )
|
||||
{
|
||||
std::cerr<<"Invalid input image\n";
|
||||
std::cout<<"Usage : tutorial_HoughCircle_Demo <path_to_input_image>\n";
|
||||
std::cout<<usage;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user