0% found this document useful (0 votes)
17 views

EXP 3 Report

The document discusses implementing the discrete Fourier transform (DFT) using the fast Fourier transform (FFT) algorithm to perform frequency domain transformations on digital images. It describes taking the FFT of an image to obtain magnitude and phase spectra, and multiplying the FFT by its complex conjugate before taking the inverse FFT to rotate the image by 180 degrees.

Uploaded by

vikasvikas017
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

EXP 3 Report

The document discusses implementing the discrete Fourier transform (DFT) using the fast Fourier transform (FFT) algorithm to perform frequency domain transformations on digital images. It describes taking the FFT of an image to obtain magnitude and phase spectra, and multiplying the FFT by its complex conjugate before taking the inverse FFT to rotate the image by 180 degrees.

Uploaded by

vikasvikas017
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

Department of Electronics &


Electrical Communication Engineering

Dual degree 4th year

Vision And Intelligent Systems

EC69505 – Digital Image And Video Processing Laboratory


Submitted by

Vikas P S - 19EC39050
Vanaja C Kodali - 18EC39002

EXPERIMENT-3

FREQUENCY DOMAIN
TRANSFORMATION

THEORY
Image filtering is useful for many applications, including smoothing,
sharpening, removing noise, and edge detection. A filter is defined by a
kernel, which is a small array applied to each pixel and its neighbours within
an image. In most applications, the centre of the kernel is aligned with the
current pixel, and is a square with an odd number (3, 5, 7, etc.) of elements in
each dimension. The process used to apply filters to an image is known as
convolution, and may be applied in either the spatial or frequency domain.
Within the frequency domain, convolution can be performed by multiplying
the FFT (Fast Fourier Transform) of the image by the FFT of the kernel, and
then transforming back into the spatial domain. The kernel is padded with
zero values to make it of the same size as the image before the forward FFT is
applied. Other method could be that filters are usually specified within the
frequency domain itself and then it is straightaway multiplied with image

pixels element by element and the IFFT is found to get the original image.

FUNCTIONS

FOR FFT AND IFFT:


Image I is converted to F(u,v) in its frequency domain using the function
“find_img_fft” with help of “fft_rec” (which finds the fft of the components
using omega value as per needed).

Inverse fft is calculated using the same “find_img_fft” where the value of bool
inverse is set to “true”.

Magnitude plot is then visualized using “form_outputimg”.


Fft_rec:
We have to find the FFT of n sample points i.e. 𝑋(𝑘) = ∑ 𝑥 (𝑛) 𝑁−1 𝑛=0 ∗ 𝑒 −𝑗
2π𝑛𝑘 𝑁

So, to find this we calculate the Fourier transform of even terms, let that
be Xe and Fourier transform of odd terms, let that be Xo then we can
calculate X(k) as 𝑋𝑒 + 𝑊𝑁 𝑘 ∗ 𝑋𝑜.

Using this recursive definition, we find the FFT in NlogN time

Omega:
Returns the omega value to be used in fft_rec as per which the
operation will be FFT or IFFT.

Find_img_fft:
Compute FFT/IFFT of all columns using the fft_rec function.

Compute FFT/IFFT of all the rows of the new matrix we got after computing
the FFT/IFFT of all the columns.

Takes input the image in complex number form and a Boolean value
“inverse” which if false, computes the FFT or else computes the IFFT.

Real_weight_conv:
To multiply real part with (-1)^(x+y)

OUTPUT RESULTS:
PART A
PART B:

DISCUSSIONS

We implemented DFT using Fast-Fourier Transform as DFT implemented


directly (even with rows and columns separated) leads to a program with a
time complexity of O(n3 ) whereas DFT implemented by FFT can solve the
problem in O(n2 log n).

First part, we computed the FFT of the image and we got the coefficients
then we converted 2D array into image and then plotted the Magnitude
Spectrum of FFT of the image.

For the phase spectrum, we computed the phases of each values using a
Formula tan(imag/real) and scaled them into the range [0,255] and plotted it.

Second part, we computed the FFT of the image, calculated its complex
conjugate, took out its IFFT and then got the result by multiplying the real
part with (-1). This resulted in the picture being rotated by 1800.

This happened so, as when complex conjugating the FFT components of the
image we made the imaginary parts of the components get mirrored w.r.t.
the real axis. And after getting the IFFT and negating the real part too, the
component turned out to be 1800 rotated from its original.

You might also like