color map and color data

조회 수: 3 (최근 30일)
Anusha
Anusha 2013년 10월 17일
답변: Walter Roberson 2013년 10월 18일
If we change a color map of an image, the color data will automatically updated or not?
ADD
for example
[cdata cmap]=imread('');
[r c]=size(cmap);
colormap=cmap(1:r,:);%store the colormap
position=colormap;
i want code for if cmap i.e)colormap changes the cdata also automatically changes

답변 (2개)

Vivek Selvam
Vivek Selvam 2013년 10월 17일
Unless you give the modified color data to colormap() it would not be updated.
For example:
load flujet;
image(X); % default colormap 'jet'
c = colormap(hsv(128)); % update
c(c>0) = 1; % no update
colormap(c); % update
  댓글 수: 1
Anusha
Anusha 2013년 10월 18일
look ADD part at the question...

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2013년 10월 18일
cdata does not update when a colormap changes. When you are using pseudocoloring, cdata remains the same and is used to index into the active color map, with you being able to activate a new map.
For example,
cm = colormap(pink(128));
image(rand(64,64));
colormap(cm);
pause(10);
colormap(flipud(cm));
pause(10);
The cdata remains the same but what is painted changes when colormap() is called.

카테고리

Help CenterFile Exchange에서 Color and Styling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by