数字图像处理实验(6):PROJECT 04-02,Fourier Spectrum and Average Value
生活随笔
收集整理的這篇文章主要介紹了
数字图像处理实验(6):PROJECT 04-02,Fourier Spectrum and Average Value
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
實驗要求:
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維幅度譜。
均值。
總結
以上是生活随笔為你收集整理的数字图像处理实验(6):PROJECT 04-02,Fourier Spectrum and Average Value的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数字图像处理实验(5):PROJECT
- 下一篇: 数字图像处理实验(7):PROJECT