Binarize from MSER regions in Matlab
Show older comments
I am currently trying to detect some nuclei in an image. For that i used the detectMSERfeatures which returns MSER regions and fits my nuclei. I want to binarize those regions on the original image but i don't know how to do it. Thanks
1 Comment
KALYAN ACHARJYA
on 13 May 2018
Question is not clear. Clarify?
Answers (2)
Jonathan
on 15 Aug 2018
Edited: Image Analyst
on 16 Aug 2018
[regions,cc] = detectMSERFeatures(im);
mask = false(size(im));
for i=1:cc.NumObjects
mask(cc.PixelIdxList{i}) = true;
end
Image Analyst
on 16 Aug 2018
Try this:
grayImage = imread('cameraman.tif');
subplot(2, 2, 1);
imshow(grayImage);
title('Original Image', 'FontSize', 20);
drawnow;
[regions, cc] = detectMSERFeatures(grayImage);
labeledImage = labelmatrix(cc);
subplot(2, 2, 2);
imshow(labeledImage)
title('LabeledImage', 'FontSize', 20);
% Apply a variety of pseudo-colors to the regions.
coloredLabelsImage = label2rgb (labeledImage, 'hsv', 'k', 'shuffle');
% Display the pseudo-colored image.
subplot(2, 2, 3);
imshow(coloredLabelsImage);
title('Labeled Regions', 'FontSize', 20);
% Create a binary mask of any region, regardless of label.
mask = labeledImage > 0;
% Display the pseudo-colored image.
subplot(2, 2, 4);
imshow(mask);
title('Mask of Any Region', 'FontSize', 20);

Categories
Find more on Biomedical Imaging in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!