An error occurred during the contour-related code.

asked 2015-08-14 10:46:34 -0500

yhd gravatar image

updated 2015-08-14 11:49:23 -0500

LBerger gravatar image
 std::vector<std::vector<cv::Point>>::iterator itc = contours.begin();
// for all contours
int cntCheck = 0;
while (itc != contours.end())
{
// verify contour size
size_t contourSize = itc->size();
if ((contourSize > 30) && (contourSize < 600))
{
++itc;
cntCheck = cntCheck + 1;
}
else
{
itc = contours.erase(itc);
}
}

This code is removing the contour that wrong size

This was code for normal operation in visual studio 2013. but This does not work in visual studio 2015.

When less than 30 works well. But an error is greater than 600.

How do i fix this?

thanks for reading.

image description

edit retag flag offensive close merge delete