两个连接边界的形态分离

mch*_*chr 7 matlab octave morphological-analysis mathematical-morphology

我有一个关于以下场景的问题.当我对图像进行后期处理时,我获得了一个轮廓,不幸的是两次连接,如您在底线所示.为了明确我想要的只是外线.因此我放大并标记了线条,我想要大图像.

我想从这个选择中得到的只是外面部分,我在下一张图片中标记为绿色.对不起我糟糕的绘画技巧.;)

我正在使用MatLab和IPT.所以我也尝试了解bwmorphhbreak选项,但它引发了一个错误.

我该如何解决这个问题?如果你成功了,请告诉我一些关于它的事情吗?先感谢您!

诚挚

Jon*_*nas 1

我也会用bwmorph

%# find the branch point
branchImg = bwmorph(img,'branchpoints');

%# grow the pixel to 3x3
branchImg = imdilate(branchImg,ones(3));

%# hide the branch point
noBranchImg = img & ~branchImg;

%# label the three lines
lblImg = bwlabel(noBranchImg);

%# in the original image, mask label #3
%# note that it may not always be #3 that you want to mask
finalImg = img;
finalImg(lblImg==3) = 0;

%# show the result
imshow(finalImg)
Run Code Online (Sandbox Code Playgroud)