MATLAB: How i can cluster the colors in this image on 3 colors (green,black,white)

classificationcolorimage processingimage segmentation

i need to show this image in 3 colors by giving one color to the similar color region
how i can combine the small regions with same color in one region as possible limits i need to reduce the number of regions.
thanks

Best Answer

[indexedImage, cmap] = rgb2ind(YourImage,3);
ReconstructedImage = ind2rgb(indexedImage, cmap);