color map and color data

2 Ansichten (letzte 30 Tage)
Anusha
Anusha am 17 Okt. 2013
Beantwortet: Walter Roberson am 18 Okt. 2013
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

Antworten (2)

Vivek Selvam
Vivek Selvam am 17 Okt. 2013
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 Kommentar
Anusha
Anusha am 18 Okt. 2013
look ADD part at the question...

Melden Sie sich an, um zu kommentieren.


Walter Roberson
Walter Roberson am 18 Okt. 2013
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.

Kategorien

Mehr zu Color and Styling finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by