(转)Matlab读取遥感影像
(2013-05-28 15:19:47)
标签:
matlab遥感 |
分类: 学习笔记 |
fname
% 输入图像(可为任意后缀,或无后缀),必须包含头文件
elements = {'samples ' 'lines
%请注意此处的cell写法,打开*.hdr比对下,否则空格错误,将读不到需要的数据
datatype = {'uint8' 'int16' 'int32' 'float32' 'float64' 'uint16' 'uint32' 'int64' 'uint64'};
% 注意ENVI和MATLAB数据类型的对应关系,参笔者其它博文(有关两种数据类型的对比)
%
% Check user input
if ~ischar(fname)
end
% Open ENVI header file to retreive s, l, b & datatype
variables
corename = strtok(fname,'.');
% 去掉后缀
rfid = fopen(strcat(corename,'.hdr'),'r');
% 添加头文件后缀,读取
% Check if the header file is correctely open
if rfid == -1
end;
% Read ENVI image header file and get
% sample : nb samples
% line : nb lines
% bands : nb bands and
% t : data type
while 1