Re: [讨论] filter 写法的小疑问

楼主: celestialgod (天)   2015-07-19 15:19:59
※ 引述《ccccoooo (西圈)》之铭言:
: 各位好,我想请问一下大家
: 以下我是我的CODE
看这样是不是你要的
m = [1/9, 2/9, 2/9; 0, 1/9, 0; 2/9, 2/9, 1/9];
a=imread('cameraman.tif')
[numrows numcols]=size(a)
s=zeros(numrows-2,numcols-2);
for i=1:numrows-2;
for j=1:numrows-2;
s(i,j)=sum(sum(a(i:i+2,j:j+2) .* m));
end
end
figure;
imshow(uint8(s))
: 以上CODE是说cameraman.tif这张图256*256
: 然后我要作出新的图为254*254
: 做的方法是从最前面3*3加起来平均的数字放进去
: 新图得1*1以此类推
作者: ccccoooo (西圈)   2015-07-19 16:12:00
thx

Links booklink

Contact Us: admin [ a t ] ucptt.com