문제

When I try to show a grayscale image using :

Img = imread('tr2.png');

subplot(111);

imshow(Img);

it does not appear as the original image. Where is the problem ?

도움이 되었습니까?

해결책

Try to read colormap together with the image:

[Img, map] = imread('tr2.png');
imshow(Img,map);

EDIT:

I believe you have indexed image and you have to convert it to RGB before any processing. Use ind2rgb or ind2gray function.

See for example Steve's blog on indexed images.

다른 팁

code to get the grayscale:

Img = imread('tr2.png');
gray=rgb2gray(Img);
imshow(gray);

(Matlab)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top