Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Colormap "wastes" picture

Subject: Colormap "wastes" picture

From: Stiphu

Date: 8 Dec, 2011 16:04:08

Message: 1 of 4

I have a GUI where I want to show a picture. In the same figure I want to do a contour plot, using the "jet" colormap.
The problem: If I change the colormap, the colormap of the picture is changed as well, the picture is wasted.

% Example
figure
[X,map] = imread('trees.tif');
imshow(X,map)
colormap(jet)

If I change the colormap before I show the image, the colormap is automatically changed to the pictures colormap.
Any suggestions?

Subject: Colormap "wastes" picture

From: Steven_Lord

Date: 8 Dec, 2011 16:25:20

Message: 2 of 4



"Stiphu " <schmutz@pyl.unibe.ch> wrote in message
news:jbqn5o$svk$1@newscl01ah.mathworks.com...
> I have a GUI where I want to show a picture. In the same figure I want to
> do a contour plot, using the "jet" colormap. The problem: If I change the
> colormap, the colormap of the picture is changed as well, the picture is
> wasted.
> % Example
> figure
> [X,map] = imread('trees.tif');
> imshow(X,map)
> colormap(jet)
>
> If I change the colormap before I show the image, the colormap is
> automatically changed to the pictures colormap.
> Any suggestions?

http://www.mathworks.com/support/tech-notes/1200/1215.html

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Colormap "wastes" picture

From: Stiphu

Date: 9 Dec, 2011 14:52:08

Message: 3 of 4

"Steven_Lord" <slord@mathworks.com> wrote in message <jbqodg$47p$1@newscl01ah.mathworks.com>...
>
>
> "Stiphu " <schmutz@pyl.unibe.ch> wrote in message
> news:jbqn5o$svk$1@newscl01ah.mathworks.com...
> > I have a GUI where I want to show a picture. In the same figure I want to
> > do a contour plot, using the "jet" colormap. The problem: If I change the
> > colormap, the colormap of the picture is changed as well, the picture is
> > wasted.
> > % Example
> > figure
> > [X,map] = imread('trees.tif');
> > imshow(X,map)
> > colormap(jet)
> >
> > If I change the colormap before I show the image, the colormap is
> > automatically changed to the pictures colormap.
> > Any suggestions?
>
> http://www.mathworks.com/support/tech-notes/1200/1215.html
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

OK, but now I want to do a contour plot with the colormap jet and display the picture. So far I didn't find a solution to make that, the contour plot now goes over the whole, self modified colormap.

Subject: Colormap "wastes" picture

From: Rob Comer

Date: 9 Dec, 2011 15:13:08

Message: 4 of 4

> OK, but now I want to do a contour plot with the colormap jet and display the picture. So far I didn't find a solution to make that, the contour plot now goes over the whole, self modified colormap.

You can use ind2rgb to convert from indexed color to RGB color. Once you do that, the image display will no longer be affected by the figure's colormap setting:

figure
[X,map] = imread('trees.tif');
imshow(ind2rgb(X,map))
colormap jet

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us