本文试图用MATLAB验证二维问题的卷积定理:空间域带滤波器的卷积等价于频域上的滤波器乘法。我写了以下代码。在第二步之后,我得到了一个模糊的图像。但是在第3步之后,我没有得到与预期相同的模糊图像,is代码的输出图如下所示。我的假设有什么不对?
% 1- Read image and create a domain frequqncy window
im = imread('High_Detail.jpg');
im = imresize(im,[100,100]);
im = rgb2gray(im);
im = im2double(im);
window_fft_shifted = zeros([100,100]);
window_fft_shifted(50-11:50+11,50-11:50+11) = 1;
% 2- FFT then Multiplying it by window then get IFFT, a blurred image expected
im_fft = fft2(im);
im_fft_shifted = fftshift(im_fft);
im_fft_shifted_W = im_fft_shifted .* window_fft_shifted;
im_result_1 = ifft2(ifftshift(im_fft_shifted_W));
% 3- Get IFFT of window, convolve im with it, the same blurred image is expected
window = ifft2(ifftshift(window_fft_shifted));
im_result_2 = conv2(im, window);
% 4- Plot
figure;
subplot(2,2,1); imshow(im);
subplot(2,2,3); imshow(im_result_1);
subplot(2,2,4); imshow(im_result_2);

发布于 2016-10-15 13:43:41
这句话:
window = ifft2(ifftshift(window_fft_shifted));应该包括用于补偿MATLAB反对称信号表示的ifftshift:
window = ifftshift(ifft2(ifftshift(window_fft_shifted)));https://stackoverflow.com/questions/40058891
复制相似问题