91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4KB
    文件類型: .m
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-14
  • 語言: Matlab
  • 標簽: matlab??envi文件??

資源簡介

matlab 讀取envi標準格式文件,代碼現成可用,只需修改輸入文件目錄,可讀取hdf格式文件

資源截圖

代碼片段和文件信息

function?[imageptb]?=?freadenvi(fname)
%?freadenvi??????????-?read?envi?image?(V.?Guissard?Apr?29?2004)
%
%??????Reads?an?image?of?ENVI?standard?type
%?????to?a?[col?x?line?x?band]?MATLAB?array
%?image=freadenvi(fname)
%?[imagep]=freadenvi(fname)
%?[imagept]=freadenvi(fname)
%?[imageptb]?=?freadenvi(fname)
%
%?INPUT?:
%
%?fname?string?giving?the?full?pathname?of?the?ENVI?image?to?read.
%
%?OUTPUT?:
%
%?image-----------?c?by?l?by?b?array?containing?the?ENVI?image?values?organised?in
%?????c?:?cols?l?:?lines?and?b?:?bands.
%?p???1?by?3?vector?that?contains?(1)?the?nb?of?cols?(2)?the?number.
%?????of?lines?and?(3)?the?number?of?bands?of?the?opened?image.
%
%?t???string?describing?the?image?data?type?string?in?MATLAB?conventions.
%?b???string?describing?the?image?data?interleave:bsqbil?or?bip
%
%?NOTE?:?????freadenvi?needs?the?corresponding?image?header?file?generated
%?????automatically?by?ENVI.?The?ENVI?header?file?must?have?the?same?name
%?????as?the?ENVI?image?file?+?the?‘.hdf‘?exention.
%?Revised?by?Hu?Shunshi2011.1.3
%?can?read?bsqbil?and?bip?data?interleave.
%%%%%%%%%%%%%

%?Parameters?initialization
elements={‘samples?‘?‘lines???‘?‘bands???‘?‘data?type?‘?‘interleave?‘};
d={‘bit8‘?‘int16‘?‘int32‘?‘float32‘?‘float64‘?‘uint16‘?‘uint32‘?‘int64‘?‘uint64‘};
interleave={‘bsq‘?‘bil‘?‘bip‘};
%?Check?user?input
if?~ischar(fname)
????error(‘fname?should?be?a?char?string‘);
end


%?Open?ENVI?header?file?to?retreive?s?l?b?&?d?variables
rfid?=?fopen(strcat(fname‘.hdr‘)‘r‘);

%?Check?if?the?header?file?is?correctely?open
if?rfid?==?-1
????error(‘Input?header?file?does?not?exist‘);
end;

%?Read?ENVI?image?header?file?and?get?p(1)?:?nb?samples
%?p(2)?:?nb?lines?p(3)?:?nb?bands?t?:?data?type?and?b:interleave
while?1
????tline?=?fgetl(rfid);
????if?~ischar(tline)?break?end
????[firstsecond]=strtok(tline‘=‘);
???
????switch?first
????????case?elements(1)
????????????[fs]=strtok(second);
????????????p(1)=str2num(s);
????????case?elements(2)
????????????[fs]=strtok(second);
????????????p(2)=st

評論

共有 條評論