Reading a RAW file from a hyperspectral camera using ENVI information
21 views (last 30 days)
Show older comments
I have captured and stored data that comes from a hyperspectral camera. This results in 2 files:
''example_file.raw''
''example_file.hdr''
I use the function read_envihdr to load ''example_file.hdr'':
example_file.hdr
>> read_envihdr('example_file.hdr')
ans =
struct with fields:
CONTENT: 'ENVI'
file_type: 'ENVI Standard'
sensor_type: 'MONARCH'
wavelength_units: 'nm'
data_type: 12
interleave: 'BSQ'
byte_order: 0
bit_depth: 10
header_offset: 0
wavelength: {10×1 cell}
gain: {10×1 cell}
exposure_time: {10×1 cell}
exposure_type: '{↵radiometric-calibration↵}'
default_bands: {[713]}
lines: 1024
samples: 1280
bands: 10
size: [1024 1280 10]
machine: 'ieee-le'
iscomplex: 0
format: 'uint16'
>>
Now, I don't have much experience reading hyperspectral data. But what I understand so far is that the ENVI standard is more or less required (or at least very handy) to load the *.raw file. Can anybody give me a hint how to proceed further to read the *.raw file now that I have the ENVI standard information available?
0 Comments
Answers (1)
Subhadeep Koley
on 11 Jun 2021
You can use the enviinfo(__) function to read metadata from your ENVI header file (.hdr file), and then you can use multibandread(_) to read the binary .raw file.
% Read ENVI header file
info = enviinfo('example_file.hdr');
% Read the .raw data file
data = multibandread('example_file.raw',[info.Height, info.Width, info.Bands],...
info.DataType, info.HeaderOffset, info.Interleave, info.ByteOrder);
NOTE: The above mentioned fetures (e.g. enviinfo(_)) come under Image Processing Toolbox's Hyperspectral Imaging Library support package, and can be downloaded from here.
2 Comments
Emma Stewart
on 5 May 2022
@Subhadeep Koley why this file is not readable with above code? this code is not working here
The HSI file size is bigger than 5 MB (Matlab attachment limit), so i have uploaded the file on drive Link to access image file: https://drive.google.com/drive/folders/1GTSkQMog4EvffH_geeKJun0oX6BCh5zo?usp=sharing
any idea thanks a ton
Emma
See Also
Categories
Find more on Hyperspectral Image Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!