How can i separate four bands from a tif image.

I have a satellite image with four bands R,G,B and NIR,how can i separate this bands.

1 Kommentar

Amira Jbara
Amira Jbara am 19 Feb. 2018
comment faire affichage de l'image avec les 4 bandes sans séparation ????

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Mohammad Abouali
Mohammad Abouali am 21 Okt. 2014

2 Stimmen

Read the image using imread or geotifread as regular Let's say i issued:
I=imread('satimage.tif');
then I is of size MxNx4
Then each band can be simply separated as:
Band1=I(:,:,1);
Band2=I(:,:,2);
Band3=I(:,:,3);
Band4=I(:,:,4);

4 Kommentare

arfa mazhar
arfa mazhar am 20 Jan. 2017
its quit helpful but how could i know which band is RED for example , which one is green or NIR
As far as I can tell, if RGB is included and if you are able to read the data from the .tif using a simple imread(), then the NIR will be the 4th plane. TIF file format does not require a particular order for the planes, but the ways that you can write in a different order would, it appears to me, result in files that you would either need to use the Tiff library to read, or which you would need to specify the image index to imread() to read.
shalitha ramanayake
shalitha ramanayake am 6 Mai 2017
Bearbeitet: shalitha ramanayake am 6 Mai 2017
hey this is this M*N mean that row*column in the image and 4 means the number of bands in the satellite image. if this is correct please reply me or correct me
Walter Roberson
Walter Roberson am 6 Mai 2017
Bearbeitet: Walter Roberson am 6 Mai 2017
Correct, shalitha ramanayake.
TIFF has several ways to store multiple bands, and a simple imread() can only handle a limited number of cases. If I understand the TIFF specification properly, then a simple imread() can only handle RGB together with at most two other bands: if there are more than two non-RGB bands then I believe that you would need to either use a different form of imread() or else you would need to use the Tiff() class to do the reading.
If you have only one non-RGB band (such as NIR) then if a simple imread() returns something with third dimension length 4, you can probably assume that the order of the bands is R, G, B, and then the fourth band. This is not entirely safe to assume, however.
If you have two non-RGB bands, then if a simple imread() returns something with third dimension length 5, you can probably assume that the order of the bands starts R, G, B, but it becomes tricky to figure out what the order of the other two bands would be.
If you have a TIFF with anything other than grayscale, or plain RGB, or RGB together with Alpha, then it is safest to use the Tiff() class to analyze the file.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by