lihonglhl159 发表于 2009-4-21 21:04

Matrix dimensions must agree?

clc;
=imread('f35.jpg');
noisy=imnoise(I,'gaussian',0.01);
imshow(noisy,map);
=size(I);
F=fft2(noisy);
fftshift(F);
Dcut=100;
D0=150;
D1=250;
for u=1:M
    for v=1:N
      D(u,v)=sqrt(u^2+v^2);
      BUTTERH(u,v)=1/(1+(sqrt(2)-1)*(D(u,v)/Dcut)^2);
      EXPOTH(u,v)=exp(log(1/sqrt(2))*(D(u,v)/Dcut)^2);
      if D(u,v)<D0
            TRAPEH(u,v)=1;
      elseif D(u,v)<=D1
            TRAPEH(u,v)=(D(u,v)-D1)/(D0-D1);
      else
            TRAPEH(u,v)=0;
      end
    end
end
BUTTERG=BUTTERH.*F;
BUTTERfiltered=ifft2(BUTTERG);
EXPOTG=EXPOTH.*F;
EXPOTGfiltered=ifftw(EXPOTG);
TRAPEG=TRAPEH.*F;
TRAPEfiltered=ifft2(TRAPEG);
subplot(2,2,1),imshow(noisy)
subplot(2,2,2),imshow(BUTTERfiltered,map)
subplot(2,2,3),imsow(EXPOTGfiltered,map)
subplot(2,2,4),imshow(TRAPEfiltered,map)

错误信息:
Warning: FFT on values of class UINT8 is obsolete.
         Use FFT(DOUBLE(X)) or FFT(SINGLE(X)) instead.
> In uint8.fft at 10
In fft2 at 25
In d3_4_5 at 6
??? Error using ==> times
Matrix dimensions must agree.
Error in ==> d3_4_5 at 25
BUTTERG=BUTTERH.*F;
请哪位高手指点

[ 本帖最后由 ChaChing 于 2009-4-22 07:45 编辑 ]

ChaChing 发表于 2009-4-21 21:32

回复 楼主 lihonglhl159 的帖子

Ref
常见的程序出错问题整理 (eight)
http://forum.vibunion.com/forum/thread-46001-1-1.html
页: [1]
查看完整版本: Matrix dimensions must agree?