import spectral # 读取ENVI格式的高光谱图像 # image的后缀可以是.raw、.spe、.lan等 # 代码里img对象,类似于rasterio库的dataset对象,可以用它来读取高光谱数据 img = spectral.envi.read_envi(file='my_data.hdr', image='my_data') 加载数据# 通过load函数获取
使用Spectral Python库中的“read_file”函数或Hyperspy库中的“load”函数可以读取高光谱数据文件。例如,使用SPy库读取ENVI格式的高光谱图像: importspectral# 读取ENVI格式的高光谱图像img=spectral.envi.read_envi('my_data.hdr','my_data') 2. 显示高光谱图像 使用Spectral Python库中的“imshow”函数或Hyperspy...
# 读取ENVI格式的高光谱图像 # image的后缀可以是.raw、.spe、.lan等 # 代码里img对象,类似于rasterio库的dataset对象,可以用它来读取高光谱数据 img = spectral.envi.read_envi(file='my_data.hdr', image='my_data') 1. 2. 3. 4. 5. 加载数据 # 通过load函数获取数据 data = img.load() # 多维...
# 使用spectral库读取ENVI文件importspectralasspdefread_hyperspectral_data(file_path):# 读取数据img=sp.open_image(file_path)print(f"数据维度:{img.shape}")returnimg# 示例调用data=read_hyperspectral_data("path_to_your_file.envi") 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 排错指南 如果在...
(".txt")and file[3]=="P":file_path=os.path.join(original_file_folder,file)df=pd.read_csv(file_path,delimiter="\t")select_df=df[df["Wavelength"].isin(target_wavelength)]select_df.insert(0,"file_name",file)data_append=select_df.iloc[1:,2:]result_df=pd.DataFrame()result_df=pd...
我们通过条件过滤,只选择以.txt结尾且文件名的第四个字母是P的文件——这些文件就是我们需要的文件。随后,对于每个满足条件的文件,我们构建了文件的完整路径file_path,并使用pd.read_csv()函数读取文件的内容。在这里,我们使用制表符作为分隔符,并将数据存储在DataFrame对象df中。
Intensity data.set_index('Wavelength (nm)', inplace=True) data['Intensity'].plot(label=labels[index]) #%% def get_spectral_info(file_path) -> pd.DataFrame: """Extract experimental details from an Ossila file into an DataFrame.""" # Open and read CSV file with file_path.open('r',...
问Python:如何读取.hdr文件附带的高光谱卫星数据EN 与多光谱数据相比,高光谱数据往往可以在地表...
README MIT license Spectral Python (SPy) Spectral Python (SPy) is a pure Python module for processing hyperspectral image data (imaging spectroscopy data). It has functions for reading, displaying, manipulating, and classifying hyperspectral imagery. Full details about the package are on theweb site...
The oscilloscope effect can give you insight into the temporal dynamics of an audio file in the time domain. Next up, you’ll reuse most of this code to show spectral changes in the frequency domain of each window. Remove ads Show a Real-Time Spectrogram Visualization While a waveform tells...