分水岭算法的过分割 [英] Over-segmentation of Watershed algorithm

查看:630
本文介绍了分水岭算法的过分割的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mathworks中关注了二维分水岭示例。 com分隔连接的对象,如下图所示:

I followed the 2-D Watershed example in Mathworks.com to separate the connected objects, like the image below:

代码总结为:

bw = imread('some_binary_image.tif');

D = -bwdist(~bw);

D(~bw) = -Inf;

L = watershed(D);

结果是:

中心的粒子已分为两部分。有没有办法在这里避免过分割?

The particle in the center has been separated into two. Are there any ways to avoid the over-segmentation here?

谢谢,lennon310,棋盘对大多数人都有效我的图像,但仍有一些情况,它没有。例如,以下二进制图像:

Thanks, lennon310, chessboard does work well for most of my images, but there are still some cases that it doesn't. For example, the following binary image:

使用棋盘将导致:

Using chessboard will result in:

由于我有数百张图像,似乎很难找到适合所有图像的参数组合。我想知道我是否需要结合使用棋盘,城市街区等获得的好结果...

As I have hundreds of images, it seems that it is difficult to find one combination of parameters that work for all images. I am wondering if I need to combine the good results got from using chessboard, cityblock, etc...

推荐答案

使用 max(abs(x1-x2),abs(y1-y2))作为距离度量(棋盘),并使用 watershed中的八连接邻域 function:

Use max(abs(x1-x2),abs(y1-y2)) as the distance metric (chessboard), and use eight-connected neighborhood in watershed function:

bw=im2bw(I);

D = -bwdist(~bw,'chessboard');
imagesc(D)
D(~bw) = -Inf;

L = watershed(D,8);
figure,imagesc(L)

结果:

这篇关于分水岭算法的过分割的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆