Clear Filters
Clear Filters

How to upload ENVI cubes with different file formats?

14 views (last 30 days)
I'm attempting to upload an ENVI cube, and to my understanding, Image Processing Toolbox and Hyperspectral Viewer require a Header file (.hdr) and an Image file (.dat, .img, .raw, .bsq, .bil, .bip). I am using the Hyperspectral Imaging software perClass Mira, but the exported filetype doesn't include an Image format in the required formats listed (.pcf, or .bin). Is there any other way to upload an ENVI cube?

Answers (1)

Vinayak Choyyan
Vinayak Choyyan on 25 Apr 2024
Hi Keegan,
As per this doc page of perClass Mira, you can export your ENVI image cubes to MATLAB supported formats too. Please try and export your data to one of the supported formats.
Once you have exported the data, you can load it in MATALB using the hypercube function and pass it to the hyperspectralViewer app or directly load the file to the app.
Additionally, if you are able to share some sample data in formats you would like to be supported in MATLAB, we will consider adding these file format supports in one of our future versions.
Regards,
Vinayak Choyyan
  2 Comments
Keegan
Keegan on 25 Apr 2024
Edited: Keegan on 25 Apr 2024
Hi Vinayak,
The file format exported by perClass Mira software for MATLAB export is .mat, which does not allow me to pass it onto the hypercube function because the required formats are ENVI, TIFF, or NITF. Additionally, using the option to export and convert to BIL uint16 also does not give me the required formats for using the hypercube function.
Is there a way to convert the .mat file into a usable header and image file? I should mention I am very new to MATLAB so I am unfamiliar with a lot of functions.
EDIT: I was able to solve the issue by renaming the .bin extension to .bil, which allowed me to use the hypercube function.
Vinayak Choyyan
Vinayak Choyyan on 26 Apr 2024
Great to here you were able to read the file into MATLAB.
.mat file is a binary format supported by MATLAB to save and load variables and data. You can read more about it here.
You can load the .mat file into MATLAB using the load function.
load("fileName.mat")
The below command will tell you what the contents of the .mat file are without loading the data
whos("-file","fileName.mat")
I assume this .mat file from perClass Mira has variables corresponding to the image cube, wavelength and header file. You can pass them to the hypercube function like this
hcube=hypercube(imageCube,wavelengthData,metadata)
If this does not help, please share the .mat file with some sample data exported from perClass Mira and I can help you with loading the exported data directly to hypercube.

Sign in to comment.

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!