converting a .tif image to a .tiff image

5 visualizaciones (últimos 30 días)
Annita
Annita el 16 de Nov. de 2021
Editada: DGM el 16 de Nov. de 2021
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.

Respuestas (1)

DGM
DGM el 16 de Nov. de 2021
Editada: DGM el 16 de Nov. de 2021
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.

Categorías

Más información sobre Image Filtering and Enhancement en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by