Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can get contours of MSER using operator().

#include <opencv2/opencv.hpp>

int main(int argc, char *argv[])
{
    Mat box = imread("box.png",1);
    MSER ms;
    vector<vector<Point>> regions;
    ms(box, regions, Mat());
    for (int i = 0; i < regions.size(); i++)
    {
        ellipse(box, fitEllipse(regions[i]), Scalar(255));
    }
    imshow("mser", box);
    waitKey(0);
    return 0;
}

image description