Ask Your Question

Slendermuse's profile - activity

2014-06-04 10:07:54 -0600 commented question Eliminate too short or too long contours - Opencv2 Cookbook

I'm sorry i'm kind of a newbie, what do you mean by c-runtime. I'm using Opencv248 (i didn't use cmake like for the older versions of OpenCV) Thanks in advence

2014-06-03 03:43:52 -0600 asked a question Eliminate too short or too long contours - Opencv2 Cookbook

Hello to everyone,

I've been following the tutorials of the OpenCV2 Cookbook, using Visual Stuido 2013. At some point I we have this code:

    // Eliminate too short or too long contours
int cmin = 1000;    // minimum contour length
int cmax = 10000;   // maximum contour length

std::vector<std::vector<cv::Point>>::iterator itc = contours.begin();

int i = 0;

while( itc != contours.end())
{
    if (itc->size() < cmin || itc->size() > cmax)
    {
        itc = contours.erase(itc);
    }
    else
        ++itc;
    std::cout << i << " ";
    i++;
}

When the compiler gets to:

itc = contours.erase(itc);

It gives me this error: image description

I've searched everywhere tried every possible way of spelling it doesn't work. And here is the driving crazy part, I tried the code on Visual Studio 2010 it worked perfectly fine.

N.B.: I've tested the same code with a vector of vector of int in visual studio 2013 and it worked fine, so I guess the problem comes from VS2013 working with OpenCV. But I have no clue why.