From a81374c1d7f139513d7ff7e2fbafea0e3a30615d Mon Sep 17 00:00:00 2001 From: ttagu99 Date: Tue, 14 Apr 2015 10:01:53 +0900 Subject: [PATCH] findcontour_example check image empty --- samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp b/samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp index bff125f..4db9349 100644 --- a/samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp +++ b/samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp @@ -26,8 +26,13 @@ void thresh_callback(int, void* ); */ int main( int, char** argv ) { - /// Load source image and convert it to gray - src = imread( argv[1], 1 ); + /// Load source image + src = imread(argv[1]); + if (src.empty()) + { + cerr << "No image supplied ..." << endl; + return -1; + } /// Convert image to gray and blur it cvtColor( src, src_gray, COLOR_BGR2GRAY ); -- 2.7.4