首页 文章

正确使用Matlab分水岭算法对细胞进行分割

提问于
浏览
1

我've run into a ton of trouble trying to get the watershed algorithm properly working on my images. In the various tutorials online they always seem to use images that are just as complicated/fuzzy and so I'我不确定我的错误 . 我've already made a couple of spotty posts on this, but wanted to really clarify and ask generally. That said, I'm使用的图像如下:

但是,当我尝试应用其中一个分水岭算法时:

imshow(RGB,[]);

gray_img = rgb2gray(RGB);
tophat_filter = imtophat(gray_img, strel('disk', 10)); %Read into this

level = graythresh(tophat_filter);
BW = im2bw(tophat_filter,level);
imshow(BW)

BW = bwdist(BW) <= 3;

imshow(BW)
bgn_remove = bwareaopen(BW,8); %remove background noise

D = -bwdist(~bgn_remove); %Read into this
D(~BW) = -Inf;
L = watershed(D);

figure;
imshow(L,[]);
figure;
imshow(label2rgb(L))
clean_img = im2bw(L,0.001);

figure;
imshow(clean_img,[]);

它似乎永远不会起作用 . 无论出于何种原因,它确定每个单元格包含一堆较小的单元格:
enter image description here

我试图通过使用 BW = bwdist(BW) <= 3; 聚集segmeneted组件来解决这个问题,以便图像不是碎片化的:

enter image description here

如第一张图片中所示,应该有3个细胞,虽然分水岭确实识别出左侧的两个不同的细胞 - 它的注册量超过应有的程度(即使在聚集后) . 在我尝试过的所有内容之后,我没有取得多大进展,所以任何帮助或建议都会非常感激 .

在完成整个分水岭程序后,我最终得到了最大值:

enter image description here

enter image description here

enter image description here

1 回答

  • 1

    你必须使用种子/约束/标记分水岭 . 如果您使用经典(不再使用)分水岭,则会面临过度分割 .

    在你的情况下,我会采用这种经典的方法来分割使用分水岭的细胞:

    • 小闭合以减少噪音 .

    • (可选)小开口,以规范细胞轮辋 .

    • 侵蚀 . 侵蚀的结果是你内在的标记 .

    • 扩张 . 扩张的结果是你的外在标记 .

    • 步骤1后生成图像的渐变(如果执行,则为2) .

    • 使用标记(步骤3和4)在梯度图像上分水岭(步骤5) .

    但是在你使用这种定义明确的细胞的情况下,我会简单地做第1步和第2步,接着是一顶礼帽 . 它会更有效,也更快 .

相关问题