How to load very large tiff file ?
Show older comments
I want to load a very large .tiff file of size 3GB, with multiband satellite image. I tried imshow which gives an error, I tried converting it into rset image but it shows only one band. I need to load the entire data without affecting for research purpose. Please guide me to open and display large files in Matlab. I want to perform various image processing tools on this image, therefore I need entire data to be loaded.
8 Comments
Geoff Hayes
on 21 Aug 2016
Please copy and paste the full error message that you observed when trying to open the file with imshow.
Livewire MGROAD
on 26 Aug 2016
Walter Roberson
on 27 Aug 2016
You cannot use imshow() for multi-plane images. I showed you how to use implay to convert the planes into time.
The Mantis Shrimp is the only known earthly species that can make use of 7 different spectra simultaneously (it has receptors for 12 frequencies.) We could probably build a device that output 7 different independent color channels, but there are no known humans who can use more than 4 independent color channels (there is apparently a suspicion that hypothetically some human women could use up to 6 independent color channels; see https://en.wikipedia.org/wiki/Pentachromacy)
In any case, MATLAB graphics are designed to handle only 3 color bands simultaneously for display.
Sushil Shakya
on 3 Oct 2018
Sir, can you tell what to be used instead of imshow() for multiplane images?
Walter Roberson
on 3 Oct 2018
You can change the additional planes into time, showing them as an animation, perhaps as a sequence of grayscale images.
I like the customization that can be done with https://www.mathworks.com/matlabcentral/fileexchange/29544-figure-to-play-and-analyze-videos-with-custom-plots-on-top
In some cases of multispectral images where the frequencies overlap the visual spectrum, you can take a model of the filters and spectral response of your sensors to try to estimate the "true" characteristics of the light source, and then calculate how a model sRGB camera (with its own filters and spectral response characteristics) would respond to that kind of light source to calculate the kind of image that would have been produced by a pure RGB camera, and display that. However, unless you were using a spectrometer, this will probably not be all that successful.
Walter Roberson
on 3 Oct 2018
Sushil Shakya
on 4 Oct 2018
Sir, it is .dat and .tif format.
Walter Roberson
on 4 Oct 2018
How do the different planes of data relate to each other? And is it important that you get an "image", or is enough to get a representation of the distribution of the data on the planes? How many planes do you have?
Answers (2)
Walter Roberson
on 21 Aug 2016
0 votes
For Tiff multiband you will probably end up needing to use the Tiff() class. However, sometimes the additional bands are implemented using Tiff indexed images, in which case you can read them using imread() and supplying an index.
There is no display routine that can handle displaying multiband (greater than 3) simultaneously. You can display multiband in sequence using implay() or the File Exchange contribution "video_fig"
6 Comments
Livewire MGROAD
on 23 Aug 2016
Walter Roberson
on 23 Aug 2016
implay( permute(YourImage, [1 2 4 3]) );
colormap(jet(256))
Svetlana Zeveleva
on 23 Mar 2018
Hi Walter, I have a tiff image that is 862x1417x4 ...do you know how I can display it? Much appreciated!
Walter Roberson
on 23 Mar 2018
Svetlana Zeveleva:
Is the TIFF image RGBA? Is it CMYK ? Is it hyperspectral that just happens to have four bands?
Svetlana Zeveleva
on 11 Apr 2018
It is RGBA.
Walter Roberson
on 3 Oct 2018
If we suppose the data has been read in to an array named RGBA then,
h = image(RGBA(:,:,1:3));
alp = RGBA(:,:,4);
if ~isdouble(RGBA); alp = im2double(alp); end
set(h, 'AlphaData', alp);
Thorsten
on 23 Aug 2016
If you can figure out if there is an R, G, and B channel in the image, say at layer 1, 2 and 3, you can use these to show an RGB image
imshow(I(:,:,1:3))
You can show the other channels as grayscale images. A conventional monitor can only display RGB, so you cannot show seven channels in a single image. That wouldn't make sense.
2 Comments
Livewire MGROAD
on 26 Aug 2016
Edited: Livewire MGROAD
on 26 Aug 2016
Walter Roberson
on 3 Oct 2018
Categories
Find more on Read, Write, and Modify Image 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!