Discrete Fourier Transform (DFT) Analysis Using MATLAB with Source Code
DFT (Discrete Fourier Transform) Analysis
Digital Image Processing Using MATLAB
Fourier Transform
The Fourier Transform is a significant image processing tool which is used to decompose an image into its sine and cosine components. The output of the conversion represents the image in the Fourier or frequency domain, though the input image is the spatial domain correspondent. Fourier domain image, each point signifies a particular frequency contained in the spatial domain image.
The Fourier Transform is used in a wide variety of applications, such as image filtering, image rebuilding, image compression and Image investigation
Periodic Signals
A continuous-time signal x(t) is periodic if: x(t + T) = x(t)
Fundamental period,
T0, of x(t) is smallest T satisfying above equation.
Fundamental frequency:
f0 = 1/T0
Fundamental angular frequency:
ω0 = 2π/T0 = 2πf0
Periodicity in Biology and Medicine
Fourier analysis
Fourier series
Expansion of continuous function into weighted sum of sins and cosines, or weighted sum of complex exponentials.
Fourier Transform
Maps one function to another: continuous-to-continuous mapping, an integral transform.
Discrete Fourier Transform (DFT)
Approximation to Fourier integral. Maps discrete vector to another discrete vector. Can be viewed as a matrix operator.
Fast Fourier Transform (FFT)
Special computational algorithm for DFT.
Discrete Fourier Transform (DFT):
(u, v) are the frequency coordinates while (x, y) are the spatial coordinates
M, N are the number of spatial pixels along the x, y coordinates
Fast Fourier Transform (FFT)
The FFT is a computationally effectual algorithm to compute the Discrete Fourier Transform and its inverse.
Assessing the sum above directly would take O(N2) arithmetic operations.
The FFT algorithm decreases the computational burden to O(N log N) arithmetic operations.
FFT needs the number of data points to be a power of 2 (usually 0 padding is used to make this true)
FFT needs evenly-spaced time series
DFT in MATLAB
Let fbe a 2D image with dimension [M,N], then its 2D DFT can be computed as follows:
Df = fft2(f,M,N);
fft2 puts the zero-frequency component at the top-left corner.
fftshift Shifts the zero-frequency component to the center. (Useful for visualization.)
MATLAB Program
f = imread(‘saturn.tif’); f = double(f);
Df = fft2(f,size(f,1), size(f,2));
figure; imshow(log(abs(Df)),[ ]);
Df2 = fftshift(Df);
figure; imshow(log(abs(Df2)),[ ]);
Result
Examine the Fourier transform of a synthetic image
f = ones(10,20);
F = fft2(f, 500,500);
f1 = zeros(500,500);
f1(240:260,230:270) = 1;
subplot(2,2,1);
imshow(f1,[]);
S = abs(F);
subplot(2,2,2);
imshow(S,[]);
Fc = fftshift(F);
S1 = abs(Fc);
subplot(2,2,3);
imshow(S1,[]);
S2 = log(1+S1);
subplot(2,2,4);
imshow(S2,[]);
Result
Fourier transform of natural images
f = imread(‘lenna.jpg’);
subplot(1,2,1);
imshow(f);
f = double(f);
F = fft2(f);
Fc = fftshift(F);
S = log(1+abs(Fc));
Subplot(1,2,2);
imshow(S,[]);
Result
a. Original image
b. corresponding DFT image
MATLAB Source Code For DFT Analysis
clc;
clear all;
close all;
a=zeros(256);
[m,n]=size(a);
for i=120:145
for j=120:145
a(i,j)=225;
end;
end;
b=imrotate(a,45,'bilinear','crop');
a1=log(1+abs(fftshift(fft2(a))));
b1=log(1+abs(fftshift(fft2(b))));
subplot(2,2,1);
imshow(a);
title('Orignal Image');
subplot(2,2,2);
imshow(b);
title('Rotate Image');
subplot(2,2,3);
imshow(mat2gray(a1));
title('orignal image spectrum');
subplot(2,2,4);
imshow(mat2gray(b1));
title('spectrum of rotate img');
RESULT
Comments
Post a Comment