OPENCV cvStartFindContours,cvFindNextContour函数内存泄露,如何解决?
CvSeq* contour = NULL;
CvSeq * tmp = NULL;
CvContourScanner scanner = NULL;
scanner = cvStartFindContours(BWimage,m_storage,sizeof(CvContour),CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE,cvPoint(0,0)); //初始化轮廓扫描器
while (contour=cvFindNextContour(scanner)) //开始遍历轮廓树
{
if (fabs(cvContourArea(contour)) >tmparea)
{
tmp = contour;
tmparea =fabs(cvContourArea(contour));
if (m_bIsCaptureTempalte == TRUE)
{
m_seqTemplate = contour;
m_fTemplteTotal = tmparea;
}
else
{
m_seqReal = contour;
m_fTotal = tmparea;
}
}
else
{
cvSubstituteContour(scanner,NULL);//删除当前的轮廓
}
}