电子1004 黄佳卿 201081163
图像傅里叶变换代码如下:
I = imread('C:\Users\jiaqing\Desktop\matlab homework\zhen.jpg'); % 读入图像
subplot(2,2,1),imshow(I);
title('zhen' );
FI = abs((fft2(I)));
NFI = 255*mat2gray(FI); %归一化
SFI = fftshift(NFI);
imgray = rgb2gray(SFI); %灰阶
subplot(2,2,2),imshow(imgray);
title('fft of zhen');
I = imread('C:\Users\jiaqing\Desktop\matlab homework\cat.jpg'); % 读入图像
subplot(2,2,3),imshow(I);
title('cat' );
FI = abs((fft2(I)));
NFI = 255*mat2gray(FI); %归一化
SFI = fftshift(NFI);
imgray = rgb2gray(SFI); %灰阶
subplot(2,2,4),imshow(imgray);
title('fft of cat');
运行结果如下:
图像添加高斯噪声与去除代码如下:
I = imread('C:\Users\jiaqing\Desktop\matlab homework\zhen.jpg'); % 读入图像
%给图像添加噪声
grayI = rgb2gray(I);
nI=imnoise(grayI,'gaussian',0.05);
subplot(2,2,1);imshow(nI);
title('加入高斯噪声后的图像');
%加入噪声后图像的傅立叶变换
FI = abs((fft2(nI)));
NFI = 255*mat2gray(FI); %归一化
SFI = fftshift(NFI);
subplot(2,2,2),imshow(SFI);
title('加入噪声后的傅里叶变换');
xd=wiener2(nI,[3 3]);
subplot(2,2,3);imshow(xd);
%去除噪声后图像的傅立叶变换
FI = abs((fft2(xd)));
NFI = 255*mat2gray(FI); %归一化 SFI = fftshift(NFI);
subplot(2,2,4),imshow(SFI);
title('去除噪声后的傅里叶变换'); 处理结果:
电子1004 黄佳卿 201081163
图像傅里叶变换代码如下:
I = imread('C:\Users\jiaqing\Desktop\matlab homework\zhen.jpg'); % 读入图像
subplot(2,2,1),imshow(I);
title('zhen' );
FI = abs((fft2(I)));
NFI = 255*mat2gray(FI); %归一化
SFI = fftshift(NFI);
imgray = rgb2gray(SFI); %灰阶
subplot(2,2,2),imshow(imgray);
title('fft of zhen');
I = imread('C:\Users\jiaqing\Desktop\matlab homework\cat.jpg'); % 读入图像
subplot(2,2,3),imshow(I);
title('cat' );
FI = abs((fft2(I)));
NFI = 255*mat2gray(FI); %归一化
SFI = fftshift(NFI);
imgray = rgb2gray(SFI); %灰阶
subplot(2,2,4),imshow(imgray);
title('fft of cat');
运行结果如下:
图像添加高斯噪声与去除代码如下:
I = imread('C:\Users\jiaqing\Desktop\matlab homework\zhen.jpg'); % 读入图像
%给图像添加噪声
grayI = rgb2gray(I);
nI=imnoise(grayI,'gaussian',0.05);
subplot(2,2,1);imshow(nI);
title('加入高斯噪声后的图像');
%加入噪声后图像的傅立叶变换
FI = abs((fft2(nI)));
NFI = 255*mat2gray(FI); %归一化
SFI = fftshift(NFI);
subplot(2,2,2),imshow(SFI);
title('加入噪声后的傅里叶变换');
xd=wiener2(nI,[3 3]);
subplot(2,2,3);imshow(xd);
%去除噪声后图像的傅立叶变换
FI = abs((fft2(xd)));
NFI = 255*mat2gray(FI); %归一化 SFI = fftshift(NFI);
subplot(2,2,4),imshow(SFI);
title('去除噪声后的傅里叶变换'); 处理结果: