Watershed segmentation in C. elegans
8 views (last 30 days)
Show older comments
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)
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)
d = bwdist(~I_celeg_3_BW);
d = imcomplement(d);
imshow(d, [])
dHmin = imhmin(d, 5);
bisonSep = watershed(dHmin);
imshow(bisonSep, [])
bisonSep(~dHmin) = 0;
imshow(bisonSep,"DisplayRange",[])
bisonOverlay = labeloverlay(I_celeg_3, bisonSep);
imshow(bisonOverlay)
Thnk you for reading
0 Comments
Answers (0)
See Also
Categories
Find more on Computer Vision with Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!