Commit 56d4f875 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

make watershed demo work correctly

parent 9948ed88
...@@ -2033,7 +2033,7 @@ cvDrawContours( void* _img, CvSeq* contour, ...@@ -2033,7 +2033,7 @@ cvDrawContours( void* _img, CvSeq* contour,
scalarToRawData( externalColor, ext_buf, img.type(), 0 ); scalarToRawData( externalColor, ext_buf, img.type(), 0 );
scalarToRawData( holeColor, hole_buf, img.type(), 0 ); scalarToRawData( holeColor, hole_buf, img.type(), 0 );
maxLevel = MAX(maxLevel, INT_MIN-2); maxLevel = MAX(maxLevel, INT_MIN+2);
maxLevel = MIN(maxLevel, INT_MAX-1); maxLevel = MIN(maxLevel, INT_MAX-1);
if( maxLevel < 0 ) if( maxLevel < 0 )
......
...@@ -86,6 +86,8 @@ int main( int argc, char** argv ) ...@@ -86,6 +86,8 @@ int main( int argc, char** argv )
findContours(markerMask, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE); findContours(markerMask, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);
if( contours.empty() )
continue;
Mat markers(markerMask.size(), CV_32S); Mat markers(markerMask.size(), CV_32S);
markers = Scalar::all(0); markers = Scalar::all(0);
int idx = 0; int idx = 0;
......
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