Azzera filtri
Azzera filtri

how to get color map of image before converting it to gray?

2 visualizzazioni (ultimi 30 giorni)
i want to convert an image to using rgb2gray for some purpose and then i want back that rgb image the problem is i dont know the way how to store colormap before converting it to gray scale and then apply that colormap later on to get back some what similar rgb if not the exactly the sameone . can any one help me please ? searched it like a day and couldnt find any thing which i understand . if any one know about this thing feel free to write small piece of code please

Risposte (1)

Image Analyst
Image Analyst il 21 Feb 2016
You can do this
[indexedImage, map] = rgb2ind(rgbImage, numColors);
Then to get back "an" rgb image (though not the original), you can do
rgbImage2 = ind2rgb(indexedImage, map);
The smaller numColors is, the more quantized/posterized the reconstructed RGB image will look.

Community Treasure Hunt

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

Start Hunting!

Translated by