Watershed segmentation in C. elegans
2 次查看(过去 30 天)
显示 更早的评论
Hi there,
I have an image with two nematodes joined. I want to apply watershed in order to separate their binary images, but I can't achieve a watershed segentation...
The code I have tryied is the next:
I_celeg_3 = imread("https://i.ibb.co/TTpQ6Ft/OLYMPUS-DIGITAL-CAMERA.jpg");
I_celeg_3 = rgb2gray(I_celeg_3); I_celeg_3 = imadjust(I_celeg_3);
%I_celeg_3 = medfilt2(I_celeg_3);
imshow(I_celeg_3)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/695489/image.png)
celeg_STD_adj_BW_unique = bwpropfilt(celeg_STD_adj_BW, "Area", 1, "largest");
imshow(celeg_STD_adj_BW_unique)
I_celeg_3_BW = ~imbinarize(I_celeg_3);
[m_ult, ~] = size(I_celeg_3); m_ult = m_ult / 300 ; I_celeg_3_BW = bwareaopen(I_celeg_3_BW, m_ult);
imshow(I_celeg_3_BW)
% Close IMAGE MORPHOLOGY
SE = strel("disk", 10);
I_celeg_3_BW = imclose(I_celeg_3_BW, SE);
imshow(I_celeg_3_BW)
I_celeg_3_BW = bwareaopen(I_celeg_3_BW, 800);
I_celeg_3_BW = imfill(I_celeg_3_BW, "holes");
I_celeg_3_BW = imclearborder(I_celeg_3_BW);
I_celeg_3_BW = bwpropfilt(I_celeg_3_BW, "Area", 1, "largest");
imshow(I_celeg_3_BW)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/695494/image.png)
d = bwdist(~I_celeg_3_BW);
d = imcomplement(d);
imshow(d, [])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/695499/image.png)
dHmin = imhmin(d, 5);
bisonSep = watershed(dHmin);
imshow(bisonSep, [])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/695504/image.png)
bisonSep(~dHmin) = 0;
imshow(bisonSep,"DisplayRange",[])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/695509/image.png)
bisonOverlay = labeloverlay(I_celeg_3, bisonSep);
imshow(bisonOverlay)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/695514/image.png)
Thnk you for reading
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!