필터 지우기
필터 지우기

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

조회 수: 6 (최근 30일)
nsyn
nsyn 2016년 1월 28일
댓글: Image Analyst 2016년 1월 28일
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
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 CenterFile Exchange에서 HDF5에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by