Got Questions? Get Answers.
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:
Color (3-channel) image and colormapping

Subject: Color (3-channel) image and colormapping

From: kees de Kapper

Date: 2 Jun, 2010 09:37:12

Message: 1 of 4

Hi All,

for image viewing purposes I want to use the colormaps to alter image level and window. This works well using single channel (say gray-scale) images but not for multi-channel (say RGB) images. FYI, I don't bother the fact that images will look less realistic, but I can better focus on details using different level and window.

In addition, the issue is similar also using the Edit->Colormap option in the figure window.

Why is this and how can I solve that?

Thanx,
Kees

Subject: Color (3-channel) image and colormapping

From: ImageAnalyst

Date: 2 Jun, 2010 11:57:43

Message: 2 of 4

You can't pseudocolor an image that's already color. You can only do
that with monochrome images. To change the colors of a true color
image you'd have to change the pixel values themselves in each of the
color channels.

Subject: Color (3-channel) image and colormapping

From: Walter Roberson

Date: 2 Jun, 2010 15:41:41

Message: 3 of 4

ImageAnalyst wrote:
> You can't pseudocolor an image that's already color. You can only do
> that with monochrome images. To change the colors of a true color
> image you'd have to change the pixel values themselves in each of the
> color channels.

If you have an RGB (truecolor) image, you can, if you want, convert it
to pseudocolor and work with it as an "indexed image". You do not have
to start with monochrome for pseudocolor images.

Subject: Color (3-channel) image and colormapping

From: ImageAnalyst

Date: 2 Jun, 2010 22:20:10

Message: 4 of 4

True, you don't have to start with one - you can create one from the
color image. To get a single-valued image (monochrome, or monochrome
with a colormap which MATLAB called "indexed"), you can do one of
several things, for example

monoImage = rgb2gray(rgbImage); % Use weighted average
[monoImage colorMap] = rgb2ind(rgbImage, n); % convert to mono and try
to come up with best guess at colormap.
monoImage = rgbImage(:,:,1); % Take the red channel (or green or blue)
Or some other custom way. Then you can display this monochrome image
with a color map using
imshow(monoImage, colorMap);
Then you can try to mess around with the colormap using Edit->Colormpa
from the figure's pulldown menu.

Tags for 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