converting a .tif image to a .tiff image
17 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
DGM
on 16 Nov 2021
Edited: DGM
on 16 Nov 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.
0 Comments
See Also
Categories
Find more on Image Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!