【问题标题】:How to identify closed connected components in an image?如何识别图像中的闭合连通分量?
【发布时间】:2015-04-17 21:12:37
【问题描述】:

给定一个二值图像,如何识别闭合组件并移除未闭合组件?

红色矩形内的对象将被保留,同时移除其他未闭合的对象。

【问题讨论】:

    标签: image matlab canny-operator


    【解决方案1】:

    您可以使用bwboundaries 查找图像中的边界。 在应用之前,您需要执行图像膨胀以识别孔洞:

    I = imread('H2b_1_canny_1.jpg');
    BW = im2bw(I, graythresh(I));
    se = strel('disk',8);
    BW = imdilate(BW,se);
    
    [B,L,N] = bwboundaries(BW);
    figure; imshow(BW); hold on;
    for k=1:length(B),
        boundary = B{k};
        if(k > N)
            plot(boundary(:,2),...
                boundary(:,1),'g','LineWidth',2);
        else
            plot(boundary(:,2),...
                boundary(:,1),'r','LineWidth',2);
        end
    end
    

    【讨论】:

    • 这种方法不能解决我的问题。我只想要连接和关闭的对象,即形成一个循环。
    猜你喜欢
    • 1970-01-01
    • 2016-12-05
    • 1970-01-01
    • 1970-01-01
    • 2018-10-08
    • 2014-03-09
    • 1970-01-01
    • 2010-10-18
    • 2011-01-05
    相关资源
    最近更新 更多