Controlling colour selections when using "labeloverlay"
9 次查看(过去 30 天)
显示 更早的评论
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 min:
0 个评论
回答(1 个)
Rishik Ramena
2020-8-6
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)
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!