how can i write a code in order to get spectral reflectance plot of a pixel in a hyperspectral image

I want to get the reflectance profile of a pixel.how can the code be written for a hypeerion hyperspectral data

1 Comment

Use the following code
reflectance = squeeze(img(i, j,:));
reflectance = reflectance/max(reflectance(:));
plot(reflectance)

Sign in to comment.

Answers (1)

Assuming you have a 3D matrix where each image plane is the scene taken at a different wavelength, you can just get a spectrum like this:
theSpectrum = hyperSpectralImage3D(row, column, :);

7 Comments

But sir ,they say that such a function does not exist in my matlab version.I am not able to do that.
I didn't use any function. What function are you talking about? Just specify some row, and some column, like row 42 and column 73, and index into your array. What is your array called? Is it called A, M, I, hyperSpectralImage3D, grayImage, multiSpecImage, or what? I have no idea. But whatever it's called, just use that row and that column and use semicolon to extract out all the spectral values:
B=A(42,73,:);
Sir this is the code i have given,but i am not getting the plot
X=multibandread('EO1H1460512012064110KZ_L1T.dat',[3481,1091,242],'int16',0,'bil','ieee-le',{'Band','Direct',[54,29,16]});
imshow (X)
S=decorrstretch(X);
imshow(S)
R=squeeze(S(540,240,:));
figure;
plot(R);
Kindly please point out my mistake.
Well, what values does R have? Do they look like normal, regular numbers? R is not empty or complex or anything is it?
R is a spectral plot with wavelength in x axis and reflectance in y axis.Wavelength and reflectance i get from all 242 bands for a pixel (540,240).Is the function wrong?
kindly waiting for your reply sir.
ALINA, I'm not sure how to answer. Please provide more info.

Sign in to comment.

Asked:

on 4 Jan 2014

Commented:

on 8 Mar 2017

Community Treasure Hunt

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

Start Hunting!