灰度图像的问题

发布于 2024-09-02 15:34:29 字数 131 浏览 6 评论 0原文

当我尝试使用 : 显示灰度图像时,

Img = imread('tr2.png');

subplot(111);

imshow(Img);

它不会显示为原始图像。问题出在哪里?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

两仪 2024-09-09 15:34:29

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

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

编辑:

我相信您已经索引了图像,并且必须在进行任何处理之前将其转换为 RGB。
使用 ind2rgbind2gray 函数。

例如,请参阅Steve 的博客 在索引图像上。

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.

只为一人 2024-09-09 15:34:29

获取灰度的代码:

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

(Matlab)

code to get the grayscale:

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

(Matlab)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文