]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
fixed drawContours (ticket #131).
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Fri, 19 Mar 2010 20:48:15 +0000 (20:48 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Fri, 19 Mar 2010 20:48:15 +0000 (20:48 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@2863 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/src/cv/cvcontours.cpp
opencv/src/cxcore/cxdrawing.cpp

index b710f5bfbc730105e386c9b792299df04f71045c..a7948efba17c0610d1a7cae6d1b60e389fb42644 100644 (file)
@@ -1587,7 +1587,7 @@ void cv::drawContours( Mat& image, const vector<vector<Point> >& 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;
index 72468016e28a66bdcdcc9a47fe94d729575d4cdc..362177acc57e400171a5518ffd38ded0e6b2c176 100644 (file)
@@ -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 );