Borrar filtros
Borrar filtros

How can I read a single band, from a multi-band GeoTiff file?

9 visualizaciones (últimos 30 días)
Ioannis Lantzanakis
Ioannis Lantzanakis el 25 de Mzo. de 2022
Respondida: Ashish Uthama el 10 de Mayo de 2024
Hi, i have spent a lot of time to figure out how can i read only a specific band from a geoTiff file.
I have a GeoTiff file with a lot of bands and i need to import to my code, only one of them.
I tried:
imread( 'mybigdata.tif' , 3 );
%Error message : Invalid TIFF image index 3.
tiffreadVolume( 'mybigdata.tif' , 'PixelRegion' , { [1 1 inf] , [1 1 inf] , [3 3] });
%Error message Requested slice 3 is greater than the number of slices (1) in the volume.
if i use X = tiffreadVolume( 'mybigdata.tif' , 'PixelRegion' , { [1 1 inf] , [1 1 inf] , [1 1] });
Name Size Bytes Class Attributes
X 1698x1493x1x13 131825928 single
I can see the 13 bands in this example, in 4th dimension for some reason, but i dont know how to read only the one of them
if i use X = imread( 'mybigdata.tif' ); , the whole image is imported again:
Name Size Bytes Class Attributes
X 1698x1493x13 131825928 single
My tiff file was created using: geotiffwrite.
Any ideas?
Thanks in Advance.

Respuestas (1)

Ashish Uthama
Ashish Uthama el 10 de Mayo de 2024
Please try the 'Bands' Name-Value argument in readgeoraster.

Community Treasure Hunt

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

Start Hunting!

Translated by