Hi everyone, I have downloaded some AVIRIS datasets from https://aviris.jpl.nasa.gov/dataportal/ and have been trying to have a look at them in MATLAB. The images I obtained, however, are strange, and don't look anything like the data preview from the page. I have looked at a few resources, including
but still have not found a solution. Can anyone please shed some light on what I am doing wrong? Here is my code:
fileNameD = 'D:\Data\AVIRIS\f160620t01p00r06rdn_b\f160620t01p00r06rdn_b\f160620t01p00r06rdn_b_sc01_ort_img';
fileNameH = [fileNameD,'.hdr'];
GainFile = 'D:\Data\AVIRIS\f160620t01p00r06rdn_b\f160620t01p00r06rdn_b\f160620t01p00r06rdn_b.gain';
gainvals = importdata(GainFile);
info = envihdrread(fileNameH); %info.data_type=2 so 16-bit signed integer
X = multibandread(fileNameD,[info.lines,info.samples,info.bands],'int16',info.header_offset,info.interleave,info.byte_order,...
{'Row','Range',[4000 1 6000]}, {'Column','Range',[1 1 info.samples]});
X1 = bsxfun(@rdivide,double(X), reshape(gainvals(:,1),[1 1 length(gainvals(:,1))])); %divide by the gain to get radiance
and here is the resulting image I obtain when I plot RGB (i.e. figure, imagesc((X1(:,:,[31,20,10]))))
versus the RGB image preview @ https://aviris.jpl.nasa.gov/aviris_locator/y16_RGB/f160620t01p00r06_sc01_RGB.jpeg (note this shows the full image, while the above is only a subset)
It bears some semblance to the image but this does not seem right. I've also plotted the spectra for some pixels and it also looks strange, e.g.
I've tried this on 4 different radiance datasets so far, as well as reflectance datasets and obtained similar results. Any suggestions will be much appreciated, thank you!

 Akzeptierte Antwort

Subhadeep Koley
Subhadeep Koley am 29 Dez. 2020

2 Stimmen

You can use the hypercube(__) function to read AVIRIS image .hdr files.
% Read the AVIRIS image (specify your image file name here)
hCube = hypercube('jasperRidge2_R198.hdr');
% Compute RGB, CIR, and falsecolored image
rgbImg = colorize(hCube, 'method', 'rgb', 'ContrastStretching', true);
cirImg = colorize(hCube, 'method', 'cir', 'ContrastStretching', true);
fcImg = colorize(hCube, 'method', 'falsecolored', 'ContrastStretching', true);
% Visualize results
figure
tiledlayout(1, 3)
nexttile
imagesc(rgbImg)
axis image off
title('RGB image')
nexttile
imagesc(cirImg)
axis image off
title('CIR image')
nexttile
imagesc(fcImg)
axis image off
title('False-colored image')
Note: All the above mentioned fetures come under Image Processing Toolbox's Hyperspectral Imaging Library support package, and can be downloaded from here.

5 Kommentare

Cheryl S
Cheryl S am 29 Dez. 2020
Bearbeitet: Cheryl S am 29 Dez. 2020
Hello, thanks very much for the prompt response. I downloaded the library and tried the function "hypercube" on multiple images, but all cases it gives the following error:
Error using enviinfo (line 54)
File type number: char not supported.
Subhadeep Koley
Subhadeep Koley am 30 Dez. 2020
@Cheryl S In my end, I am able to load the "f160620t01p00r06rdn_b_sc01_ort_img.hdr" image using hypercube(__) without any error.
Therefore, I suspect you have one local function in the name of "enviinfo.m", which is conflicting with the Hyperspectral Imaging Library's own enviinfo(__) function.
Rename or delete your local "enviinfo.m" function and then try again.
Cheryl S
Cheryl S am 30 Dez. 2020
Oh, you're right, I did as you suggested and it works now! I also combined enviinfo with multibandread to extract only a subset of the image and it works as well! Must be an issue with my original enviinfo.m file. Thank you very much for your help!
Lahcen EDDAHBI
Lahcen EDDAHBI am 23 Mär. 2022
thank you so much for the information.
i appriciate
Jennifer Lumbres
Jennifer Lumbres am 4 Jun. 2022
Bearbeitet: Jennifer Lumbres am 4 Jun. 2022
@Subhadeep Koley I followed your instructions and downloaded the same data. However, I'm getting an error with opening the data using hypercube:
Input:
hcube = hypercube('f160620t01p00r06rdn_b_sc01_ort_img.hdr');
Error output:
Error using hypercube>validateImageFile (line 1310)
Image file size must be 6062044800 bytes, but it is 6142384518 bytes.
Error in hypercube (line 281)
validateImageFile(imgfile, obj.Metadata);
Error in data_open_hypercube (line 1)
hcube = hypercube('f160620t01p00r06rdn_b_sc01_ort_img.hdr');
Any input will help me greatly. Thanks.
Edit: I downloaded the data through here: https://popo.jpl.nasa.gov/avcl/y16_data/f160620t01p00r06.tar.gz

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Shiqi Feng
Shiqi Feng am 1 Mär. 2022

0 Stimmen

hello, I want to ask how to get .hdi file from AVIRIS datasets?

Produkte

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by