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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Image Analyst
Image Analyst il 6 Apr 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.

Accedi per commentare.

Risposta accettata

Adam
Adam il 8 Apr 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.

Più risposte (1)

Steven Lord
Steven Lord il 8 Apr 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.

Categorie

Scopri di più su Colormaps in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by