简体   繁体   English

图像处理 - Matlab中的灰度级TIFF图像

[英]Image processing - TIFF images in Matlab in grayscale

In Matlab, when I use 在Matlab中,当我使用时

imshow('trees.tif')

it displays an RGB image, but when I use these two functions 它显示RGB图像,但是当我使用这两个功能时

I=imread('trees.tif')
imshow(I)

it displays a gray scale image, and it's still the exact same image. 它显示灰度图像,它仍然是完全相同的图像。

This only happens with TIFF images, because when I use it for a JPEG image like so: 这只发生在TIFF图像上,因为当我将它用于JPEG图像时,如下所示:

I=imread('flower.jpg')
imshow(I)

it displays an RGB image, and it's the same thing as imshow('flower.jpg') . 它显示一个RGB图像,它与imshow('flower.jpg')

Can anyone please explain why the use of imread / imshow on TIFF images displays them in gray scale? 任何人都可以解释为什么在TIFF图像上使用imread / imshow以灰度显示它们?

Load the color map too: 也加载颜色贴图:

[I,cmap] = imread('trees.tif');

Display it with the map: 用地图显示:

imshow(I,cmap)

Convert it to RGB: 将其转换为RGB:

Irgb = ind2rgb(I,cmap)

So you can display and manipulate it without the colormap: 因此,您可以在没有色彩映射的情况下显示和操作它:

imshow(Irgb)
imagesc(Irgb)
% etc.

Eye candy: 秀色可餐:

在此输入图像描述在此输入图像描述在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM