Question

write a matlab code to compare K Means, Mean shift and Fuzzy C clustering algorithms using images
0 0
Add a comment Improve this question Transcribed image text
Answer #1

IF YOU HAVE ANY DOUBTS COMMENT BELOW I WILL BE TTHERE TO HELP YOU..ALL THE BEST..

AS FOR GIVEN DATA...

write a matlab code to compare K Means , Mean shift and Fuzzy C clustering algorithms using images.

SOLUTION ::

Step 1: Read Image

he = imread('hestain.png');

imshow(he), title('H&E image');

text(size(he,2),size(he,1)+15,...

'Image courtesy of Alan Partin, Johns Hopkins University', ...

'FontSize',7,'HorizontalAlignment','right');

Step 2: Convert Image from RGB Color Space to L*a*b* Color Space

lab_he = rgb2lab(he);

Step 3: Classify the Colors in 'a*b*' Space Using K-Means Clustering

ab = lab_he(:,:,2:3);
ab = im2single(ab);
nColors = 3;
% repeat the clustering 3 times to avoid local minima
pixel_labels = imsegkmeans(ab,nColors,'NumAttempts',3);
imshow(pixel_labels,[])
title('Image Labeled by Cluster Index');

Step 4: Create Images that Segment the H&E Image by Color

mask1 = pixel_labels==1;
cluster1 = he .* uint8(mask1);
imshow(cluster1)
title('Objects in Cluster 1');
mask2 = pixel_labels==2;
cluster2 = he .* uint8(mask2);
imshow(cluster2)
title('Objects in Cluster 2');
mask3 = pixel_labels==3;
cluster3 = he .* uint8(mask3);
imshow(cluster3)
title('Objects in Cluster 3')

Step 5: Segment the Nuclei

L = lab_he(:,:,1);
L_blue = L .* double(mask3);
L_blue = rescale(L_blue);
idx_light_blue = imbinarize(nonzeros(L_blue));
blue_idx = find(mask3);
mask_dark_blue = mask3;
mask_dark_blue(blue_idx(idx_light_blue)) = 0;

blue_nuclei = he .* uint8(mask_dark_blue);
imshow(blue_nuclei)
title('Blue Nuclei');

HOPE IT HELPS YOU

RATE THUMBSUP IT HELPS ME ALOT

THANKS

Add a comment
Know the answer?
Add Answer to:
write a matlab code to compare K Means, Mean shift and Fuzzy C clustering algorithms using images write a matlab code to compare K Means, Mean shift and Fuzzy C clustering algorithms using i...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT