What are indexed image?

60 次查看(过去 30 天)
aamir shabbir hussain
评论: Stephen23 2015-7-30
I read the details for indexed images in the matlab help all i get to know is that the color map and image are directly mapped 1 to 1 but what`s the use of indexed image. What is the purpose of color map ? And the figure in the matlab help what does 5 mean? please guide in detail someone
  3 个评论
aamir shabbir hussain
Just types image types in help and go to overview of image types you will get the above picture. THanks for your answer

请先登录,再进行评论。

回答(3 个)

Guillaume
Guillaume 2015-7-27
There are two different reasons why you'd use an indexed image.
1) if the numbers of different colours in your image is fairly low, then an indexed image uses less memory / disk space than a coloured image. That's because encoding colour takes three times as much space as encoding an index. For example, a 500 x 500 indexed image with 256 8-bit colours takes: 500*500*1 (indexed image) + 256*3 (palette) bytes = 25 kb, whereas the same encoded as an rgb image takes 500*500*3 = 75kb. If you reduce the number of colours to less than 256, then the advantage of indexing the image is even greater.
2) You actually don't really care what the colours are as long as they are different. For example, imagine your image consist of three shapes. You just want to say that the triangle is colour 1, the circle colour 2, and the square colour 3 (background is 0). So you store these indices in the image, and alongside you store a colour palette where 0 is black, 1 is red, 2 is blue and 3 is green. Later on, you can just change the mapping by editing the colour palette without touching the image itself. For example set the square to pink by just change the colour of index 3 in the palette.

Jan
Jan 2015-7-27
编辑:Jan 2015-7-27
The "colormap" is a list of colors. The colors are store in the "rgb-format", which means one value between 0 and 1 per red, green and blue channel. Therefore the color table has 3 columns.
The 5 means, that the corresponding pixel has the fifth color of the colormap: it is the fifth line.

aamir shabbir hussain
Thanks to both of u for answering........please tell me this that how can i make a color map means if do imread a image in matlab in rgb format how can i make a color map of theat image. ?
  2 个评论
Walter Roberson
Walter Roberson 2015-7-28
numcolors = 20; %for example
[X,map] = rgb2ind(TheRGBArray, numcolors);
This will pick the 20 most representative colors -- the ones leading to the smallest difference in color between actual color and represented color.
If you want to create a colormap with one entry for every unique R, G, B combination, then
M = reshape(TheRGBArray, [], 3);
[map, ~, ind_vect] = unique(M, 'rows');
X = reshape(ind_vect, size(TheRGBArray,1), []);
This does have some uses, but it will not usually save memory unless there are fewer than about 64 distinct R, G, B combinations in the image.
Image Analyst
Image Analyst 2015-7-28
aamir, can you tell me why you'd want to do that? Why not just deal with the original RGB image? What good does an indexed image do you? You're throwing away information to be able to use a pseudocolor look up table, but why? That won't help you find, segment, or classify anything. If you just want to color certain things you found in the image you can use normal segmentation methods and use an overlay or assignment or outlines to indicate the region(s) you found.

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by