function b = block(data, wh, ww)
% block the data and caculate the sum of each block
% the edge of the data which could not full fill a block will be ignored % ww: the width of the block
% wh: the height of the block if nargin == 1
ww = 16;
wh = 16;
end if nargin == 2
wh = ww;
end
[ir, ic] = size(data); br = floor(ir/wh);
bc = floor(ic/ww); mr = 1; for i = 1:br
mc = 1;
for j = 1:bc
ff = data(mr:mr+wh-1, mc:mc+ww-1);
b(i, j) = sum(sum(ff));
mc = mc + ww;
end
mr = mr + wh;
end
哪位大神帮忙看看改哪里可以运行程序
% block the data and caculate the sum of each block
% the edge of the data which could not full fill a block will be ignored % ww: the width of the block
% wh: the height of the block if nargin == 1
ww = 16;
wh = 16;
end if nargin == 2
wh = ww;
end
[ir, ic] = size(data); br = floor(ir/wh);
bc = floor(ic/ww); mr = 1; for i = 1:br
mc = 1;
for j = 1:bc
ff = data(mr:mr+wh-1, mc:mc+ww-1);
b(i, j) = sum(sum(ff));
mc = mc + ww;
end
mr = mr + wh;
end
哪位大神帮忙看看改哪里可以运行程序