How to load very large tiff file ?

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

Please copy and paste the full error message that you observed when trying to open the file with imshow.
Error using imageDisplayValidateParams>validateCData (line 113) Multi-plane image inputs must be RGB images of size MxNx3.
Error in imageDisplayValidateParams (line 27) common_args.CData = validateCData(common_args.CData,image_type);
Error in imageDisplayParseInputs (line 78) common_args = imageDisplayValidateParams(common_args);
Error in imshow (line 219) [common_args,specific_args] = ...
Error in f4 (line 2) imshow(K)
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.
Sir, can you tell what to be used instead of imshow() for multiplane images?
You can change the additional planes into time, showing them as an animation, perhaps as a sequence of grayscale images.
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.
Sir, it is .dat and .tif format.
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?

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 21 Aug 2016
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

I tried the following method, but imshow displays cannot display more than MxNx3 image. My image is of size 2434 x 4805 x 7, with 7 components. I used implay but it displays only grayscale image.
implay( permute(YourImage, [1 2 4 3]) );
colormap(jet(256))
Hi Walter, I have a tiff image that is 862x1417x4 ...do you know how I can display it? Much appreciated!
Svetlana Zeveleva:
Is the TIFF image RGBA? Is it CMYK ? Is it hyperspectral that just happens to have four bands?
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);

Sign in to comment.

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

Filename: 'C:\Users\BATMAN\Documents\MATLAB\4\test.tif'
FileModDate: '25-Aug-2016 17:14:16'
FileSize: 754980300
Format: 'tif'
FormatVersion: []
Width: 7601
Height: 7771
BitDepth: 96
ColorType: 'grayscale'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: [16 16 16 16 16 16]
Compression: 'Uncompressed'
PhotometricInterpretation: 'BlackIsZero'
StripOffsets: []
SamplesPerPixel: 6
RowsPerStrip: 4.2950e+09
StripByteCounts: []
XResolution: 1
YResolution: 1
ResolutionUnit: 'None'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: 512
TileLength: 512
TileOffsets: [1x240 double]
TileByteCounts: [1x240 double]
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: [65535 65535 65535 65535 65535 65535]
MinSampleValue: [0 0 0 0 0 0]
Thresholding: 1
Offset: 754977514
Software: 'IMAGINE TIFF Support
Copyright 1991 - 1999 by ERDAS, Inc. All Rights Reserve...'
ExtraSamples: [0 0 0 0 0]
SampleFormat: {1x6 cell}
ModelPixelScaleTag: [30 30 0]
ModelTiepointTag: [0 0 0 314685 1395015 0]
GeoKeyDirectoryTag: [1x28 double]
GeoAsciiParamsTag: 'IMAGINE GeoTIFF Support
ERDAS IMAGINE 9.3 Service Pack 1 GeoTIFF support
Pro...'

Sign in to comment.

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Asked:

on 21 Aug 2016

Commented:

on 4 Oct 2018

Community Treasure Hunt

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

Start Hunting!