PDA

查看完整版本 : 灰度图像问题


poster
2019-12-10, 20:41
当我尝试使用显示灰度图像时:

Img = imread('tr2.png'); subplot(111); imshow(Img); 它不会显示为原始图像。问题出在哪里 ?



回答:

尝试与图像一起读取颜色图:

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

我相信您已经索引了图像,并且必须在进行任何处理之前将其转换为RGB。使用ind2rgb (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/ind2rgb.html)或ind2gray (http://www.mathworks.com/access/helpdesk/help/toolbox/images/ind2gray.html)函数。

例如,参见有关索引图像的Steve博客 (http://blogs.mathworks.com/steve/2006/02/03/all-about-pixel-colors-part-2/) 。



更多&回答... (https://stackoverflow.com/questions/2884832)