【问题标题】:OpenCV How to find seam lines in an image?OpenCV如何在图像中找到接缝线?
【发布时间】:2018-04-24 10:57:50
【问题描述】:

在 InRange 和 GaussianBlur 函数之后,我得到以下图像:

我找到了边缘,我得到了:

我需要从这张图中得到三行,如下图所示(非红色的线为凸起的节点):

我该怎么做?

【问题讨论】:

  • 骨架化你的图像

标签: c# opencv emgucv


【解决方案1】:

您应该使用带有巧妙结构元素的侵蚀操作。 我建议用最长的水平线长度的来去除。

我做了一个小例子:

让我们把这个toErode.png

        double longestHorLine = 201;
        Image<Gray, byte> toErode = new Image<Gray, byte>(path+ "toErode.png");
        for(int i =1;i<4;i++)
        {
            Mat element = CvInvoke.GetStructuringElement(ElementShape.Rectangle, new Size((int)(longestHorLine / i), 3), new Point(-1, -1));
            CvInvoke.Erode(toErode, toErode, element, new Point(-1, -1), i, BorderType.Default, new MCvScalar(0));
            toErode.Save(path + "res"+i+".png");
        }

产生以下输出:res1.pngres2.pngres3.png

【讨论】:

    猜你喜欢
    • 2012-01-06
    • 2019-10-01
    • 2012-02-07
    • 2020-05-21
    • 2013-07-08
    • 2018-12-01
    • 2020-01-18
    • 1970-01-01
    • 2011-11-07
    相关资源
    最近更新 更多