[英]How to read wavelength information from envi file in spectral python libraray?
I am working on hyperspectral imagery which is in envi format.我正在研究 vi 格式的高光谱图像。 I have successfully read it using spectral python library.
我已经使用光谱 python 库成功读取了它。 Now , I want to get each band (wavelength center).
现在,我想得到每个波段(波长中心)。 Kindly suggest method for this task.
请建议此任务的方法。
If you open the ENVI image with the spectral module, the wavelengths (band centers) are in the bands.centers
attribute of the opened image.如果使用光谱模块打开 ENVI 图像,波长(波段中心)在打开图像的
bands.centers
属性中。
>>> import spectral as spy
>>> img = spy.open_image('EO1H0150332002114111KZ.L1R.hdr')
>>> print(img.bands.centers[:5])
[355.59, 365.76, 375.94, 386.11, 396.29]
You can also get the raw header metadata from the metadata
attribute of the opened image.您还可以从打开的图像的
metadata
属性中获取原始标题元metadata
。
>>> print(img.metadata.keys())
dict_keys(['description', 'samples', 'lines', 'bands', 'header offset', 'file type', 'data type', 'interleave', 'sensor type', 'byte order', 'band names', 'read procedures', 'wavelength', 'fwhm', 'subset procedure'])
>>> print(img.metadata['wavelength'][:5])
['355.59', '365.76', '375.94', '386.11', '396.29']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.