Effacer les filtres
Effacer les filtres

Controlling colour selections when using "labeloverlay"

17 vues (au cours des 30 derniers jours)
Sam Yu
Sam Yu le 31 Juil 2020
Hi, I've applied kmeans clustering to a batch of images, and I am using "labeloverlay" to display the results. However, I am finding that the colours in each picture varies significantly (see attached outptuts). For better comparison effects, I am wondering if it is possible to manually assign colours to different clusters of each picture? For example, I want to keep the background cluster of each image to be green.
time = 0 min:time = 488 time = 488 min:

Réponses (1)

Rishik Ramena
Rishik Ramena le 6 Août 2020
As per my understanding, you are trying to have a custom color scheme for the clusters(labels) generated using K-Means. You can use the Colormap paramenter for labeloverlay function. For further details and examples, refer to the Create Custom Colormap documentation. Here’s a snippet with a simple implementation.
A = imread('coins.png');
t = im2bw(A)+1;
B = labeloverlay(A,t,'Colormap',[1 0 0; 0 0.9 0]);
imshow(B)

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by