How to generate NDVI from HDF-4 data. (OCM-2 level-1 HDF-4)

1 次查看(过去 30 天)
Hi,
I have used hdftool, hdfread commands, But my HDF file has only one dataset, then how can i generate NDVI. My matlab commands are given below
hdftool('F:\MATLAB\HDF data\binned hdf\OCMHDFFiles_20-Sep-2012\O2_01APR2011_004_000_GAN_L3B_CL_M.hdf');
Band_3 = hdfread('F:\MATLAB\HDF data\binned hdf\OCMHDFFiles_20-Sep-2012\O2_01APR2011_004_000_GAN_L3B_CL_M.hdf','clo','Fields','?');
Band_2 = hdfread('F:\MATLAB\HDF data\binned hdf\OCMHDFFiles_20-Sep-2012\O2_01APR2011_004_000_GAN_L3B_CL_M.hdf','clo','Fields','?');
Band_1 = hdfread('F:\MATLAB\HDF data\binned hdf\OCMHDFFiles_20-Sep-2012\O2_01APR2011_004_000_GAN_L3B_CL_M.hdf','clo','Fields','?');
% Calculate NDVI.
Band_2 = im2single(Band_2);
Band_3 = im2single(Band_3);
SPCrater_NDVI = (Band_3 - Band_2) ./ (Band_3 + Band_2);
% Display the image.
j=imresize(SPCrater_NDVI,0.5);
figure(5)
% Note that because the range of numbers in our NDVI ratio is between
% 0 and 1, we need to display the image's colors using an appropriate scale
% [0 1]
imshow(j,'DisplayRange',[0 1])
Here my question is indicated by '?' symbol within the codings.
Can anyone please help me to solve this issue.
I really appreciate any help you can provide. I will be grateful if you can send me this information.
M. Prabu
(maprabu)

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by