Colormap for Connected Components in an image
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
CuriousThinker
el 27 de Feb. de 2016
Comentada: CuriousThinker
el 13 de Mzo. de 2016
Hello all,
Is there a way I can assign individually different colors to the connected components obtained using bwareafilt() function, labeled in an image? I have tried using colormap() function. But it doesn't work.
Thanks in advance.
0 comentarios
Respuesta aceptada
Image Analyst
el 27 de Feb. de 2016
Yes. See this snippet from my Image Segmentation Tutorial:
% 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
% coloredLabels is an RGB image. We could have applied a colormap instead (but only with R2014b and later)
imshow(coloredLabels);
axis image; % Make sure image is not artificially stretched because of screen's aspect ratio.
caption = sprintf('Pseudo colored labels, from label2rgb().\nBlobs are numbered from top to bottom, then from left to right.');
title(caption, 'FontSize', 20);
4 comentarios
Image Analyst
el 7 de Mzo. de 2016
I don't see how it could color just a corner of the squares since the square is a solid color throughout. You'll have to share your code for me to fix it.
Más respuestas (1)
Ver también
Categorías
Más información sobre Color and Styling en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!