How to convert the raw hyperspectral image (hawaii or yellowstone)into .mat file?

15 views (last 30 days)
I have raw images which I has taken from the link
I need to convert this raw files to .mat file through the matlab, so that I can get the image band by band

Accepted Answer

Walter Roberson
Walter Roberson on 9 May 2019
X = multibandread('hawaii_sc01.raw', [512, 614, 224], '*uint16', 0, 'bip', 'ieee-be');
The datatype is uint16 but the data is 12 bit, so the used portion is theoretically 0 to 4095 but in practice the range is 82 to 1006, so call it [0 1023]
According to the README, that particular file is the above size, and the maine file below it is a different size also 12 bit, and all of the rest of the files are 512 lines x 680 samples x 224 bands, instrument bit depth = 16 bits which would correspond to
X = multibandread(filename, [512, 680, 224], '*uint16', 0, 'bip', 'ieee-be');
You would have to examine the values to see what the actual data range is.
  4 Comments
Shrish Bajpai
Shrish Bajpai on 10 May 2019
Respected Sir,
As per ypur suggestion, I used the following commands to draw the i image of the band 100, but I am not getting what I need to get get. It is image that contains only alt and pepper noise.
X = multibandread('aviris_sc0.raw', [224 680 512],'int16',0, 'bip', 'ieee-be');
X100=squeeze(X(100,:,:));
I request you kindly guide me if I am wrong.
Walter Roberson
Walter Roberson on 10 May 2019
filename = 'aviris_sc0.raw';
X = multibandread(filename, [512, 680, 224], '*uint16', 0, 'bip', 'ieee-be');
X100 = fliplr(X(:,:,100));
imshow(X100,[])
Now compare to the first false-color image at https://coding.jpl.nasa.gov/hyperspectral/falsecolor.html and it will be obvious that the data has been extracted in the right order.

Sign in to comment.

More Answers (1)

Shrish Bajpai
Shrish Bajpai on 10 May 2019
Respected Sir,
It is working!!!
Thanks for guiding me and solving my problem which I was stuck for last six month (still hawaii is there which I am not able to convert).
Again I thanks to you by my folding hands (Indian Hindu culture) for guiding me on the issue.
Regards,
Shrish Bajpai
Detail Code as follows
Dim = [512,680,224]; % lines, samples, bands
dType = 'int16'; % for data type 2
hOffset = 0;
intlve = 'bip';
border = 'ieee-be'; % For byte order 1
X = multibandread('aviris_sc3.raw',Dim,dType,hOffset,intlve,border);
figure; imshow(X(:,:,1),[])
  1 Comment
Walter Roberson
Walter Roberson on 10 May 2019
Earlier I posted
X = multibandread('hawaii_sc01.raw', [512, 614, 224], '*uint16', 0, 'bip', 'ieee-be');
Before I posted that I tested it and compared it to the sample images that they provided, so I was sure that the data was read properly.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!