cvFindContours in video

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

cvFindContours in video

ekrem guner
i am using cvFindContours in video file.
But i can not find out what to do for release dyn. storage properly
at the end of each cycle.
I try cvReleaseMemStorage, cvClearSeq etc.
But I am really confused and i can not use them properly (having
memory leaks).
This is the code. Help me please!

CvMemStorage* storage = cvCreateMemStorage(0) ;
CvSeq *contour;
while (GetNewFrame){


   cvFindContours(gray, storage, &contour, sizeof(CvContour),    

   CvSeq *pNext;
   while (contour){
      pNext = contour->h_next;
      CvScalar color = CV_RGB(255, 0, 0);
      cvDrawContours( img, contour,  color, color, -1, 1, 8 );
      contour = pNext;
   // HERE what to do