What does 'Colormap' do to the image with double/float pixels?

6 vues (au cours des 30 derniers jours)
gccat
gccat le 5 Avr 2019
I think that 'Colormap' is for index image which has only integer elements
however, when I use the code below
%Img is gray scale
Img=Img-min(Img(:));
Img=Img./(max(Img(:))-min(Img(:)));
imshow(Img,[],'Colormap',jet(256))
Colormap can also work and produce a color image (if it is without 'Colormap', the result become black and white)
What does 'Colormap' do to the image with double/float pixels?
  3 commentaires
gccat
gccat le 6 Avr 2019
Thank you, this is really helpful !
Image Analyst
Image Analyst le 6 Avr 2019
Adam, can you post this as an official "Answer" down below in the official Answers section, rather than up here in Comments which is supposed to be used for asking the poster to clarify their question? You can even get "Credit" for it down there, unlike up here.

Connectez-vous pour commenter.

Réponse acceptée

Adam
Adam le 8 Avr 2019
Data is linearly binned into however many bins/elements your colourmap has and that colour applied.
e.g. if your data is 0-1 and you had a 10-element colourmap then it would be split
0-0.1 - 1st colour
0.1-0.2 - 2nd colour
etc
Obviously 0.1 would map to only 1 colour with either a < or <= relationship used, but this is just a rough example of what happens anyway.
Which is the same, by the way, as for integer images anyway as unless your integer images has the same number of values (and indexed from 1) as your colourmap the data still has to be binned.

Plus de réponses (1)

Steven Lord
Steven Lord le 8 Avr 2019
Since your variable name is img, I assume you're planning to display this using the image function in MATLAB. If so look at the CDataMapping name-value pair argument and the C input argument in the Input Arguments section on that documentation page.

Catégories

En savoir plus sur Colormaps dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by