make watershed demo work correctly

This commit is contained in:
Vadim Pisarevsky 2010-12-04 15:35:34 +00:00
parent 9948ed88b0
commit 56d4f875b4
2 changed files with 3 additions and 1 deletions

View File

@ -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 )

View File

@ -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;