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 CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by