please, how do we give each region a color after the segmentation ?

3 vues (au cours des 30 derniers jours)
heba sal
heba sal le 17 Nov 2018

Réponses (2)

Guillaume
Guillaume le 17 Nov 2018
label2rgb is one way to do it.

Image Analyst
Image Analyst le 17 Nov 2018
Try this:
labeledImage = bwlabel(binaryImage, 8); % Label each blob so we can make measurements of it
% labeledImage is an integer-valued image where all pixels in the blobs have values of 1, or 2, or 3, or ... etc.
imshow(labeledImage, []); % Show the gray scale image.
title('Labeled Image, from bwlabel()', 'FontSize', captionFontSize);
% Let's assign each blob a different color to visually show the user the distinct blobs.
coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle'); % pseudo random color labels
where "binaryImage" is your segmented image, or possibly you've already labeled it and labeledImage is your segmented image.

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by