file format not supported by Hyperspectral Imaging Libray
Show older comments
The Hyperspectral Imaging Libray does not seem to be working with my .hdr and .bil file. I got error when reading the .hdr file: Input file must be a ENVI header file.
My hyperspectral camera is PHOTON SYSTEMS INSTRUMENTS NVIR camera, it generates .bil and .hdr files. Here is an example .hdr file:
BYTEORDER I
LAYOUT BIL
NROWS 385
NCOLS 500
NBANDS 480
NBITS 12
BANDROWBYTES 1000
TOTALROWBYTES 480000
BANDGAPBYTES 0
CHROMATICCORRECTION True
STARTWAVELENGTH 352.485
ENDWAVELENGTH 898.805
INTEGRATIONTIME 49999
WAVELENGTHS
352.49
353.64
...
WAVELENGTHS_END
Is there any method to read such a .hdr file?
And how can I generate a hycube object using the .bil and .hdr file?
I tried reading the .bil file using multibandread() and construct a structure with meta data, and then use hypercube(image,wavelength,metadata), but I find that it seems to only support 'bsq' interleave, not 'bil' interleave.
Here is my code:
hcubeData = multibandread('/path/to/file.bil',[385 500 480],'ubit12=>uint16',0,'bil','ieee-le');
s = struct;
s.Height = 385;
s.Width = 500;
s.Bands = 480;
s.DataType = 'uint16';
s.Interleave = "bil";
s.ByteOrder = "ieee-le";
wavelength = [352.49 .... 898.81]; % a 1X480 vector
hcube = hypercube(hcubeData,wavelength,s);
In this way, I can generate the hcube, but it is using 'bsq' interleave format instead of 'bil' interleave (i.e., the meta 's' passed to the constructor hypercube didn't work). I traced back the code in the library and find that it's hard-coded to be using 'bsq' interleave.
Any suggestions on how to read my hyperspectral data? If i want to use the library, what shall I do?
Thank you!
Accepted Answer
More Answers (0)
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!