K-means image processing color scales

I've recently had a problem with the coloring of the data clusters in K-means image processing. I'm trying to process multiple images to sort color gradients in the image into three distinct clusters, but each time I run K-means I get different colors representing each cluster. Is there any way to control this? I'm using the basic K-means image processing that's on this site.
I = imread('north_sm_gray.bmp');
imshow(I)
title('north sm')
[L,Centers] = imsegkmeans([I],3);
B = labeloverlay(I,L);
imshow(B)
title('north sm processed')

 Respuesta aceptada

Srivardhan Gadila
Srivardhan Gadila el 1 de Mayo de 2020
Refer to the Colormap Name-Value Pair Argument of the function labeloverlay.
colorMap = [1 0 0; 0 0 1; 0 1 0];
B = labeloverlay(I,L,'Colormap',colorMap);

Más respuestas (0)

Categorías

Más información sobre Modify Image Colors en Centro de ayuda y File Exchange.

Preguntada:

el 26 de Abr. de 2020

Respondida:

el 1 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by