Skip to content
shimat edited this page Jan 19, 2019 · 1 revision
using (Mat src = new Mat("foo.png", LoadMode.Color))
using (Mat gray = new Mat())
using (Mat dst = src.Clone())
{
    Cv2.CvtColor(src, gray, ColorConversion.BgrToGray);

    MSER mser = MSER.Create();
    Point[][] contours = mser.Run(gray, null);   // MSER::operator()
    foreach (Point[] pts in contours)
    {
        Scalar color = Scalar.RandomColor();
        foreach (Point p in pts)
        {
            dst.Circle(p, 1, color);
        }
    }

    using (new Window("MSER src", src))
    using (new Window("MSER gray", gray))
    using (new Window("MSER dst", dst))
    {
        Cv.WaitKey();
    }
}
Clone this wiki locally