我'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,[]);
它似乎永远不会起作用 . 无论出于何种原因,它确定每个单元格包含一堆较小的单元格:
我试图通过使用 BW = bwdist(BW) <= 3; 聚集segmeneted组件来解决这个问题,以便图像不是碎片化的:
如第一张图片中所示,应该有3个细胞,虽然分水岭确实识别出左侧的两个不同的细胞 - 它的注册量超过应有的程度(即使在聚集后) . 在我尝试过的所有内容之后,我没有取得多大进展,所以任何帮助或建议都会非常感激 .
在完成整个分水岭程序后,我最终得到了最大值: