資源簡介
matlab版本衛(wèi)星遙感圖像數(shù)據(jù)的讀取 與打開
代碼片段和文件信息
function?[?colslinesbandsdata_typeoffsetimaging_way?]?=?myNewMultiBandRead(?hdrFileNamehdrFilePath?)
%UNtitleD2?此處顯示有關(guān)此函數(shù)的摘要
%???此處顯示詳細說明
elements={‘samples?‘?‘lines?‘?‘bands?‘?‘header?offset?‘?‘data?type?‘?‘interleave?‘};
way={‘?bsq‘?‘?bil‘?‘?bip‘};
%檢查相應(yīng)的頭文件是否能夠打開
rfid?=?fopen(fullfile(hdrFilePathhdrFileName)‘r‘);
if?(rfid?==?-1)
?????error(‘Input?header?files?does?not?exist‘);
end
cols=2048;lines=2100;bands=150;data_type=‘uint16‘;offset=0;imaging_way=‘bil‘;
%如果能夠正確打開
?while?1
????tline?=?fgetl(rfid);
????if?~ischar(tline)?break?end
????[firstsecond]=strtok(tline‘=‘);
????switch?first
????????case?elements(1)
????????????[~s]=strtok(second);
????????????cols=str2double(s);
????????case?elements(2)
????????????[~s]=strtok(second);
????????????lines=str2double(s);
????????case?elements(3)
????????????[~s]=strtok(second);
????????????bands=str2double(s);
????????case?elements(4)
????????????[~s]=strtok(second);
????????????offset=str2double(s);
????????case?elements(5)
????????????[~s]=strtok(second);
????????????t=str2double(s);
????????????switch?t
??????????????
評論
共有 條評論