0
我在使用MATLAB讀取和處理多個tiff文件時遇到了問題,因爲我是MATLAM軟件的初學者。我有300個相同維度的tiff圖像。我想循環這個過程,但是,我無法得到它。到目前爲止,我只是每次更改文件名來閱讀和處理。我還沒有從哪裏開始。誰能幫我。在這裏,我附上我的編碼。使用MATLAB讀取和處理多個.TIFF文件
filename=('brd06330_s0239.tif');
fileinfo=imfinfo(filename);
Nfiles=numel(fileinfo);
Cloud=cell(Nfiles,1);
for n=1:Nfiles
A=imread(filename);
[rimg cimg]=size(A);
% Read by band (for this task only use band 1)
B1Channel = A(:, :, 1);
% A=imread(filename);
% [rimg cimg]=size(A);
%for channel 1
W_countB1 = sum(sum(B1Channel == 0)) % W= water
NW_countB1 = sum(sum(B1Channel > 0)) % NW= non water (cloud and land)
end
%save in text format(excel)
d=[W_countB1,NW_countB1]
colname={W_countB1,NW_countB1}
xlswrite('brd06330_s0239',d)