How to plot RGB and each band image from MODIS hdf file?
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Image Analyst
2016-1-28
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()?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 HDF5 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!