Unable to retrieve SubIFD (for tif image)
조회 수: 2 (최근 30일)
이전 댓글 표시
t = Tiff('F:\SIH20\tree\Bareilyoutput.tif','r');
offsets = t.getTag('SubIFD');
t.setSubDirectory(offsets(1));
subimage_one = t.read();
imagesc(subimage_one)
t.close();

How do I fix above error please help.
Image info
Filename: 'F:\SIH20\cloud\INSAT3D_TIR1_India\3DIMG_07NOV2019_0130_L1C_SGP.tif'
FileModDate: '27-Dec-2019 05:58:53'
FileSize: 4235502
Format: 'tif'
FormatVersion: []
Width: 1074
Height: 984
BitDepth: 32
ColorType: 'grayscale'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: 32
Compression: 'Uncompressed'
PhotometricInterpretation: 'BlackIsZero'
StripOffsets: [1x984 double]
SamplesPerPixel: 1
RowsPerStrip: 1
StripByteCounts: [1x984 double]
XResolution: []
YResolution: []
ResolutionUnit: 'Inch'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: 4.2950e+09
MinSampleValue: 0
Thresholding: 1
Offset: 8
SampleFormat: 'IEEE floating point'
ModelPixelScaleTag: [0.0335 0.0335 0]
ModelTiepointTag: [0 0 0 62.9884 38.0290 0]
GeoKeyDirectoryTag: [1x32 double]
GeoDoubleParamsTag: [298.2572 6378137]
GeoAsciiParamsTag: 'WGS 84|'
댓글 수: 0
답변 (1개)
Riya
2025년 6월 18일
Hi Amritanjali,
I understand that you are encountering the error “Unable to retrieve SubIFD” while working with a “TIFF” image in MATLAB using the “Tiff” class. This error occurs because the image file you are using does not contain any Sub Image File Directories (“SubIFDs”), which are typically used for storing additional image levels like overviews or pyramids. As a result, calling “getTag('SubIFD')” fails since this tag does not exist in your image.
To fix this issue and successfully read the image, you should skip the attempt to access the “SubIFD” tag and simply read the image directly using either of the following approaches:
Option 1 – Using “imread” function:
I = imread('F:\SIH20\tree\Bareilyoutput.tif');
imagesc(I); axis image; colormap gray; colorbar;
Option 2 – Using the “Tiff” object directly:
t = Tiff('F:\SIH20\tree\Bareilyoutput.tif', 'r');
I = t.read();
t.close();
imagesc(I); axis image; colormap gray; colorbar;
If you are expecting “SubIFDs” (such as in multi-resolution “TIFFs”), please ensure that your image source supports them. You can check the structure using:
info = imfinfo('F:\SIH20\tree\Bareilyoutput.tif');
If “info” returns only one structure, then your image does not contain “SubIFDs” or multiple “IFDs”.
For further reference on working with the “Tiff” class and its available tags, kindly refer to the official documentation below:
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!