필터 지우기
필터 지우기

Cameraman.tif is an indexed image?

조회 수: 70 (최근 30일)
Gautam
Gautam 2015년 1월 8일
댓글: adil erraad 2022년 4월 5일
Is the image "cameraman.tif" an indexed image?
[I , map] = imread('cameraman.tif')
size(map) % says an empty matrix
but changing the colormap changes it's color, why?
colormap(jet) % Changes the color of image.

채택된 답변

Guillaume
Guillaume 2015년 1월 8일
Most likely, 'cameraman.tif' is just a greyscale image.
In any case, colormap works just as well for greyscale images, so is not any indication:
imshow(randi([0 255], 500, 500, 'uint8'));
colormap(summer);
  댓글 수: 2
Guillaume
Guillaume 2015년 1월 8일
'cameraman.tif' is a greyscale image, as shown by:
imfinfo 'cameraman.tif'
ans =
[...]
ColorType: 'grayscale'
[...]
adil erraad
adil erraad 2022년 4월 5일
greattss

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Adam
Adam 2015년 1월 8일
I would assume it is an indexed image in that case and if so you would fully expect changing the colourmap to change the image.
  댓글 수: 2
Gautam
Gautam 2015년 1월 8일
Yeah , I agree to that and it changes color on changing the colormap. But how come the map is empty. Thanks for your reply
Image Analyst
Image Analyst 2015년 1월 8일
Because any grayscale image CAN be an indexed image. Like Guillaume says you can apply a colormap to a gray scale image because it will just use the gray level as an index. But with regular gray scale images, there is no colormap stored with the image. With indexed images there it, and needs to be, because the indexed image is essentially a color image with only 256 colors. If you look at an indexed image, the value is not a gray level but an index into a pseudocolor look up table. If you look at it with a gray(256) colormap, it may look like garbage. Look at the demo image canoe.tif, which is an indexed image:
[indexedImage, colorMap] = imread('canoe.tif');
imshow(indexedImage);
colorbar
It looks like garbage when viewed with a linear gray scale look up table because the values are not gray levels but are actually indexed into a row of a colormap. A value of 200 does not mean that the image is twice as bright as a pixel with value 100, like it would for a gray scale image (with no gamma). It simply means that the pixels with value 200 should use the 200th color (which may be blue or anything) while pixels with the value 100 should use the 100th color (which may be brown).
Now look at the same image when we use the colormap that was stored with it:
[indexedImage, colorMap] = imread('canoe.tif');
imshow(indexedImage);
colorbar
colormap(colorMap);
Let me know if that explains it better.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by