btcblock.m
来自「BTC的基本方法」· M 代码 · 共 39 行
M
39 行
function outbuf=btcblock(inbuf,size)
temp=0;
q=0;
temp0=0;
temp1=0;
for m=1:size
for n=1:size
temp=temp+double(inbuf(m,n));
end;
end;
xt=round(temp/(size*size));
for m=1:size
for n=1:size
if (inbuf(m,n)>=xt)
q=q+1;
temp1=temp1+double(inbuf(m,n));
else
temp0=temp0+double(inbuf(m,n));
end;
end;
end;
if q~=size*size
a0=round(temp0/(size*size-q));
end;
if q~=0
a1=round(temp1/q);
end;
for m=1:size
for n=1:size
if(inbuf(m,n)<xt)
outbuf(m,n)=a0;
else
outbuf(m,n)=a1;
end;
end;
end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?