实验要求:

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('三维图像显示相位谱');

实验结果:
数字图像处理实验(6):PROJECT 04-02,Fourier Spectrum and Average Value                                                                                                         标签:               图像处理MATLABfft                                            2017-05-07 23:1
上图是原始图像。

数字图像处理实验(6):PROJECT 04-02,Fourier Spectrum and Average Value                                                                                                         标签:               图像处理MATLABfft                                            2017-05-07 23:1
上图是FFT之后3维幅度谱。

数字图像处理实验(6):PROJECT 04-02,Fourier Spectrum and Average Value                                                                                                         标签:               图像处理MATLABfft                                            2017-05-07 23:1
上图是FFT之后3维幅度谱。

数字图像处理实验(6):PROJECT 04-02,Fourier Spectrum and Average Value                                                                                                         标签:               图像处理MATLABfft                                            2017-05-07 23:1
均值。

相关文章:

  • 2021-10-20
  • 2021-07-09
  • 2021-11-26
  • 2021-06-04
  • 2022-01-26
  • 2021-08-11
  • 2021-11-30
  • 2021-12-30
猜你喜欢
  • 2021-08-25
  • 2021-07-16
  • 2021-07-18
  • 2021-07-27
  • 2021-06-22
  • 2021-10-28
  • 2021-08-11
相关资源
相似解决方案