Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
Arif Nouman Khan
Arif Nouman Khan le 21 Fév 2016
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

Réponses (1)

Image Analyst
Image Analyst le 21 Fév 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.

Catégories

En savoir plus sur Red dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by