提交 38904c9a 编写于 作者: A Adrien BAK

fix exception being thrown when no arguments are passed

上级 094d7c49
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册