spectral plot of hyperspectral image

2 views (last 30 days)
ALINA
ALINA on 22 Jan 2014
Answered: Parth Parikh on 30 Nov 2022
Hi sir, This is the code i wrote X=multibandread('EO1H1460512012064110KZ_L1T.dat',[3481,1091,155],'int16',0,'bil','ieee-le',{'Band','Direct',[54,29,16]}); S=decorrstretch(X); spectrum=S(2000,500,:); band=size(spectrum); band=band(3); for n=0:(band-1) x(n+1)=(n*5)+1; y(n+1)=spectrum(1,1,n+1); end plot(x,y) xlabel('band no.'); ylabel('reflectance');
But sir,can you help me with this code so that i get a proper spectral plot.

Answers (1)

Parth Parikh
Parth Parikh on 30 Nov 2022
Hi Alina,
I guess you would like to extract the spectral information from the hyperspectral data at location [2000,500]. In that case you should use multibandread something like this:
X=multibandread('EO1H1460512012064110KZ_L1T.dat',[3481,1091,155],'int16',0,'bil','ieee-le',{'Band','Direct',[1:155]});
S=decorrstretch(X);
spectrum=squeeze(S(2000,500,:));
plot(spectrum);
Simpler way I would suggest is:
hcube = hypercube('EO1H1460512012064110KZ_L1T.dat');
S = decorrstretch(hcube.DataCube);
spectrum = squeeze(S(2000,500,:));
plot(spectrum);
For more details take a look at this documentation: Read hyperspectral data - MATLAB (mathworks.com)
Hope it helps !

Community Treasure Hunt

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

Start Hunting!