How to see Hyperspectral Image from a .MAT file
23 views (last 30 days)
Show older comments
I have a .mat file for hyperspectral image containing 220 bands. I am trying to see the image from the .mat file.
My MATLAB version is 2018 a.
Can anyone give me some advice how to see the Hyperspectral Image ???
Any assistance will be highly appreciated.
2 Comments
Walter Roberson
on 19 Jun 2021
There were new hyperspectral tools introduced in R2020a; https://www.mathworks.com/help/images/hyperspectral-image-processing.html
Answers (1)
Image Analyst
on 19 Jun 2021
What does this say
s = load('yourMatFile.mat') % No semicolon. Replace with your actual filename.
fieldnames(s)
Do you have 220 fields? Like s.Band1?
img = s.Band1;
imshow(img, []);
One 3-D array? So you'd have to extract the one band from the array.
See attached document.
8 Comments
User1
on 10 Oct 2022
Image Analyst, to be honest, I have not seen any of your answers solve the problems but instead create another ones. Please, be more specific with your answers.
Image Analyst
on 10 Oct 2022
@User1, the comment @Shibly gave above seems to indicate that I did solve his problem, even though he didn't click the "Accept this answer" link. Perhaps you need to click the "Show older comments" link to see it.
I don't see how I created any additional problems here. In general you wil notice that my answers are far and away more detailed than other people's answers. I often/usually give fully tested, well commented full demos that solve the problem using the example image the user posted, and using very descriptive variable names. This is way more than most people do. The poster can then take my code and integrate it into their main program. On occasion the poster does not supply enough info for an answer, so sometimes we need to ask the user to clarify something or attach data.
If you have any problems specific to yourself, feel free to post them as new discussion threads.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!