Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What does map mean in the function [X,map] = rgb2ind(I,256) ?

274 views
Skip to first unread message

Jeevashini

unread,
Feb 7, 2008, 9:32:01 AM2/7/08
to

Hi everyone,

Could someone explain what 'map' means in the following
matlab code :

I = imread('cat.jpg');
[X,map] = rgb2ind(I,256);

I can understand the relationship between X and map.
X(1,1) = 12, for instance says the color of the 1st pixel
in image is the colour represented in row 12 of 'map'
matrix.

What I dont understand is the way the colour is
represented in each row of the 'map' matrix. For example :

if

12 0.0039216 0.011765 0.0039216

is a particular colour in row 12 of 'map', then what does
the decimal value in each column mean and how is it
derived?

Please let me know this at the earliest as I need to
understand this in order to continue with my final year
project.

Many thanks,
Jeevashini

Steven Lord

unread,
Feb 7, 2008, 9:54:49 AM2/7/08
to

"Jeevashini " <vash...@mathwork.com> wrote in message
news:fof4p1$hum$1...@fred.mathworks.com...

>
> Hi everyone,
>
> Could someone explain what 'map' means in the following
> matlab code :
>
> I = imread('cat.jpg');
> [X,map] = rgb2ind(I,256);

That's the colormap generated by the RGB2IND function for your new indexed
image X.

> I can understand the relationship between X and map.
> X(1,1) = 12, for instance says the color of the 1st pixel
> in image is the colour represented in row 12 of 'map'
> matrix.
>
> What I dont understand is the way the colour is
> represented in each row of the 'map' matrix. For example :
>
> if
>
> 12 0.0039216 0.011765 0.0039216
>
> is a particular colour in row 12 of 'map', then what does
> the decimal value in each column mean and how is it
> derived?

It's an RGB vector. You should read through these documents; they describe
colormaps, RGB vectors, and indexed images and how these things interact.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/colormap.html

http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f5-41276.html

http://blogs.mathworks.com/steve/2006/02/03/all-about-pixel-colors-part-2/

--
Steve Lord
sl...@mathworks.com


0 new messages