converting a .tif image to a .tiff image

5 次查看(过去 30 天)
Annita
Annita 2021-11-16
编辑: DGM 2021-11-16
Hello,
I have just recently started to use matlab for image processing. I need to work with two images, one is with the format .tiff and the other one has the format .tif
The size of the .tiff image is [ 512 512 1] while the size of the .tif one is [512 512 2]. I want the the size of the .tif image be [512 512 1] instead of [512 512 2]. How can I acheiev this? Thanks for your help in advance.

回答(1 个)

DGM
DGM 2021-11-16
编辑:DGM 2021-11-16
Both are TIFF files. That said, TIFF is a very flexible format and it's used for a wide array of things across many technical disciplines. It's hard to say what a MxNx2 image is inteded to be. A 2-channel image might be interpreted as volumetric data, or in other contexts, it may be a monochrome image with alpha.
If we assume that the two channels represent comparable quantities (e.g. visible light intensity), then you could choose perhaps to simply average them.
A = imread('fileA.tif');
A = mean(A,3); % average both channels
imwrite(A,'fileA_modified.tiff')
Or you could do any number of other mathematical operations to reduce the two channels to one (e.g. max() min()). Alternatively, you could just pick one of the two channels if one has some particular significance in your context.

类别

Help CenterFile Exchange 中查找有关 Image Filtering and Enhancement 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by