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

6 ビュー (過去 30 日間)
gccat
gccat 2019 年 4 月 5 日
回答済み: Steven Lord 2019 年 4 月 8 日
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 件のコメント
gccat
gccat 2019 年 4 月 6 日
Thank you, this is really helpful !
Image Analyst
Image Analyst 2019 年 4 月 6 日
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.

サインインしてコメントする。

採用された回答

Adam
Adam 2019 年 4 月 8 日
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.

その他の回答 (1 件)

Steven Lord
Steven Lord 2019 年 4 月 8 日
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.

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by