How to plot RGB and each band image from MODIS hdf file?

12 Ansichten (letzte 30 Tage)
nsyn
nsyn am 28 Jan. 2016
Kommentiert: Image Analyst am 28 Jan. 2016
Hello,
I am new user in matlab and modis
Now, I am trying to plot RGB image and image from each band using hdf data "MOD021KM", RGB is band 1,4 and 3in modis
this is my code:
file_name = 'MOD021KM.A2015274.0320.005.2015278201601.hdf';
% open data : hdftool('MOD021KM.A2015274.0320.005.2015278201601.hdf')
% read data HDF file
EV_250_Aggr1km_RefSB = hdfread('MOD021KM.A2015274.0320.005.2015278201601.hdf', ...
'MODIS_SWATH_Type_L1B', 'Fields', 'EV_250_Aggr1km_RefSB',...
'Index',{[1 1 1],[1 1 1],[2 2030 1354]});
EV_500_Aggr1km_RefSB = hdfread('MOD021KM.A2015274.0320.005.2015278201601.hdf', ...
'MODIS_SWATH_Type_L1B', 'Fields', 'EV_500_Aggr1km_RefSB',...
'Index',{[1 1 1],[1 1 1],[5 2030 1354]});
lat = hdfread(file_name,'Latitude');
long = hdfread(file_name,'Longitude');
data = EV_250_Aggr1km_RefSB;
% initialize each band of the result image with the original image
red = squeeze(data(:,:,1,:));
green = squeeze(data(:,:,3,:));
blue = squeeze(data(:,:,4,:));
can you help me, please check it and let me know what code should I use to plot data for each band? and after that in RGB?
  1 Kommentar
Image Analyst
Image Analyst am 28 Jan. 2016
What does "plot" mean when you're talking about an image? Do you mean display? If so, then use imshow(). Or maybe you mean surf()?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by