Ask Your Question

Revision history [back]

// Only accept CV_8UC1
// binImage must be the image with your rectangle detected
if (binImage.channels() != 1 || frame.type() != CV_8U)
    return;

destframe = Mat::zeros(binImage.size(), binImage.type()); //create a mat to accumulate the results

// Find all contours

vector<vector<Point>> contours;
findContours(frame.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); //will find all 

for (int i = 0; i < contours.size(); i++)
{

    // Paint all contours
        drawContours(destframe, contours, i, CV_RGB(0,0,255), -1);
}
// Only accept CV_8UC1
// binImage must be the image with your rectangle detected
if (binImage.channels() != 1 || frame.type() != CV_8U)
    return;

destframe = Mat::zeros(binImage.size(), binImage.type()); //create a mat to accumulate the results

// Find all contours

vector<vector<Point>> contours;
findContours(frame.clone(), findContours(binImag.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); //will find all 

for (int i = 0; i < contours.size(); i++)
{

    // Paint all contours
        drawContours(destframe, contours, i, CV_RGB(0,0,255), -1);
}