findcontour_example check image empty

This commit is contained in:
ttagu99 2015-04-14 10:01:53 +09:00 committed by Dikay900
parent 66fc6126d2
commit a81374c1d7

View File

@ -26,8 +26,13 @@ void thresh_callback(int, void* );
*/ */
int main( int, char** argv ) int main( int, char** argv )
{ {
/// Load source image and convert it to gray /// Load source image
src = imread( argv[1], 1 ); src = imread(argv[1]);
if (src.empty())
{
cerr << "No image supplied ..." << endl;
return -1;
}
/// Convert image to gray and blur it /// Convert image to gray and blur it
cvtColor( src, src_gray, COLOR_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );