补全代码:clear;clc % 读取图像文件 img = imread('Lena01.bmp'); img =imresize(img,0.2); % 显示原始图像 subplot(2, 2, 1); imshow(img); title('Original Image'); % 计算傅里叶变换 f = double(img); F = zeros(size(f)); [M, N] = size(f); for u = 0:M-1 for v = 0:N-1 for x = 0:M-1 for y = 0:N-1 end end end end % 显示傅里叶变换后的图像 subplot(2, 2, 2); imshow(log(1+abs(F)), []); title('Fourier Transform'); % 计算傅里叶逆变换 f2 = zeros(size(f)); for x = 0:M-1 for y = 0:N-1 for u = 0:M-1 for v = 0:N-1 end end end end
时间: 2024-02-29 19:57:27 浏览: 284
补全代码如下:
clear;clc % 读取图像文件
img = imread('Lena01.bmp');
img =imresize(img,0.2);
% 显示原始图像
subplot(2, 2, 1);
imshow(img);
title('Original Image');
% 计算傅里叶变换
f = double(img);
F = zeros(size(f));
[M, N] = size(f);
for u = 0:M-1
for v = 0:N-1
for x = 0:M-1
for y = 0:N-1
F(u+1, v+1) = F(u+1, v+1) + f(x+1, y+1) * exp(-2j*pi*((u*x/M)+(v*y/N)));
end
end
end
end
% 显示傅里叶变换后的图像
subplot(2, 2, 2);
imshow(log(1+abs(F)), []);
title('Fourier Transform');
% 计算傅里叶逆变换
f2 = zeros(size(f));
for x = 0:M-1
for y = 0:N-1
for u = 0:M-1
for v = 0:N-1
f2(x+1, y+1) = f2(x+1, y+1) + F(u+1, v+1) * exp(2j*pi*((u*x/M)+(v*y/N)));
end
end
end
end
% 显示傅里叶逆变换后的图像
subplot(2, 2, 3);
imshow(uint8(f2));
title('Inverse Fourier Transform');
阅读全文