How to load AVIRIS datasets
조회 수: 9 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
채택된 답변
Subhadeep Koley
2020년 12월 29일
% 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
Jennifer Lumbres
2022년 6월 4일
편집: Jennifer Lumbres
2022년 6월 4일
@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
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!