Binarize from MSER regions in Matlab

3 views (last 30 days)
Raquel Alves
Raquel Alves on 11 May 2018
Answered: Image Analyst on 16 Aug 2018
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

Answers (2)

Jonathan
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
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);

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!