Matlab 傅里叶域中的高斯滤波器

Matlab 傅里叶域中的高斯滤波器,matlab,fft,gaussian,Matlab,Fft,Gaussian,我尝试用matlab在傅里叶域中应用高斯滤波器,结果是模糊的,但输出图像像一个谜一样混乱,我不知道为什么 img='src.pgm'; scale=10; I=imread(img); S=size(I); TF_I=zeros([S(1) S(2)]); TF_I= fft2(I); mask = fspecial('gaussian',S(1),scale); TF_mask=fft2(mask); TF_out = TF_I.*TF_mask; img_out=ifft2(TF

我尝试用matlab在傅里叶域中应用高斯滤波器,结果是模糊的,但输出图像像一个谜一样混乱,我不知道为什么

img='src.pgm';
scale=10;

I=imread(img);
S=size(I);
TF_I=zeros([S(1) S(2)]);

TF_I= fft2(I);

mask = fspecial('gaussian',S(1),scale);

TF_mask=fft2(mask);

TF_out = TF_I.*TF_mask;

img_out=ifft2(TF_out);

img_out=uint8(img_out);

imshow(img_out);
试试这个:

TF_mask=fft2(ifftshift(mask));
DFT(fft
fft
计算的内容)假定原点位于左上角像素处<代码>掩码< /代码>在图像的中间有原点。code>ifftshift将原点移动到左上角的像素。

尝试以下操作:

TF_mask=fft2(ifftshift(mask));
DFT(fft
fft
计算的内容)假定原点位于左上角像素处<代码>掩码< /代码>在图像的中间有原点。code>ifftshift将原点移动到左上角像素