数字图像处理实验(6):PROJECT 04-02,Fourier Spectrum and Average Value

本文介绍了一种使用MATLAB编程实现图像的傅里叶变换(FFT),并展示了如何通过中心化频谱来观察图像的傅里叶频谱。此外,还提供了计算图像平均灰度值的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

实验要求:

Objective:
To observe the Fourier spectrum by FFT and the average value of an image.
Main requirements:
Ability of programming with C, C++, or Matlab.
Instruction manual:
(a) Download Fig. 4.18(a) and compute its (centered) Fourier spectrum.
(b) Display the spectrum.
(c) Use your result in (a) to compute the average value of the image.

实验中我们要观察图像进行FFT后的傅里叶频谱图,并且输出其均值。

代码:

%%
close all;
clc;
clear all;

%%
img = imread('gray_image.jpg');
imshow(img);
title('original image');

% 计算傅里叶变换
img_F = fft2(img);

[M, N] = size(img);
s = sum(abs(img_F(1:M, 1:N)));  % 行求和
s = sum(s);     % 列求和
ave = s / (M * N);
disp(['average value of image is: ',num2str(ave)]);

S = log(1 + abs(img_F));
% figure;
% plot(S);
% title('二维图像显示幅度谱');

x = 0:1:255;
y = 0:1:255;
[x, y] = meshgrid(x, y);
figure;
mesh(S);
title('三维图像显示幅度谱');

img_Q = angle(img_F);
% figure;
% plot(img_Q);
% title('二维图像显示相位谱');

x = 0:1:255;
y = 0:1:255;
[x, y] = meshgrid(x, y);
figure;
mesh(img_Q);
title('三维图像显示相位谱');

实验结果:
这里写图片描述
上图是原始图像。

这里写图片描述
上图是FFT之后3维幅度谱。

这里写图片描述
上图是FFT之后3维幅度谱。

这里写图片描述
均值。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值