S.EB
S.EB

Reputation: 2226

How to plot the NIR spectral signal from the hypercube data in python?

I have the following data available from the hyperspectral imaging:

How can I plot the reflectance vs wavelength plot? Is there any sample python code that I can use?

Upvotes: 0

Views: 172

Answers (1)

bogatron
bogatron

Reputation: 19179

To plot an arbitrary pixel, you can use the spectral module to read the pixel data and wavelengths (assuming wavelength metadata are in the ENVI header):

import spectral as spy
import matplotlib.pyplot as plt

img = spy.envi.open('cube_envi32.hdr')
(i, j) = (10, 10) # coordinates of pixel to display
plt.plot(img.bands.centers, img[i,j])

If you want to plot spectra interactively, see the spectral documentation here.

Upvotes: 1

Related Questions