From 29e21b2302d86fe5bcf03a6db9e015e40534e11e Mon Sep 17 00:00:00 2001 From: vp153 Date: Fri, 19 Mar 2010 20:48:15 +0000 Subject: [PATCH] fixed drawContours (ticket #131). git-svn-id: https://code.ros.org/svn/opencv/trunk@2863 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08 --- opencv/src/cv/cvcontours.cpp | 2 +- opencv/src/cxcore/cxdrawing.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/opencv/src/cv/cvcontours.cpp b/opencv/src/cv/cvcontours.cpp index b710f5bf..a7948efb 100644 --- a/opencv/src/cv/cvcontours.cpp +++ b/opencv/src/cv/cvcontours.cpp @@ -1587,7 +1587,7 @@ void cv::drawContours( Mat& image, const vector >& contours, !ci.empty() ? (void*)&ci[0] : 0, (int)ci.size(), &seq[i], &block[i] ); } - if( hierarchy.empty() || maxLevel == 0 || maxLevel == INT_MAX ) + if( hierarchy.empty() || maxLevel == 0 || contourIdx < 0 ) for( i = first; i < last; i++ ) { seq[i].h_next = i < last-1 ? &seq[i+1] : 0; diff --git a/opencv/src/cxcore/cxdrawing.cpp b/opencv/src/cxcore/cxdrawing.cpp index 72468016..362177ac 100644 --- a/opencv/src/cxcore/cxdrawing.cpp +++ b/opencv/src/cxcore/cxdrawing.cpp @@ -2034,6 +2034,7 @@ cvDrawContours( void* _img, CvSeq* contour, h_next = contour->h_next; contour->h_next = 0; maxLevel = -maxLevel+1; + maxLevel -= maxLevel < 0; } cvInitTreeNodeIterator( &iterator, contour, maxLevel ); -- 2.39.2