CSE445
Image Processing
Frequency Domain
Dr. Azer Çelikten
Spatial vs Frequency Domain
• So far, we have analyzed images in the spatial domain —that
is, by looking at the positions of pixels and their intensity
values.
• However, sometimes we want to understand how often
certain patterns or textures repeat within an image.
• This gives us information about the frequency content of the
image.
• To obtain this information, we need to transform the image
from the spatial domain to the frequency domain.
2
Fourier Theory
The Fourier series is a
mathematical representation that
allows a periodic function (or
signal) to be expressed as the sum
of an infinite number of sine and
cosine functions.
• A sin( ωx + Φ )
This method is used in signal
processing and engineering to
analyze complex waveforms.
3
Fourier Theory
Example : g(t) = sin(2πf t) + (1/3)sin(2π(3f) t)
= +
Slides: A. Efros
4
Fourier Theory
Can you identify the fundamental
component of the periodic waveform ?
5
Fourier Theory
1st component 2nd component
= +
6
Fourier Theory
3rd component
= +
7
Fourier Theory
4th component
= +
8
Fourier Theory
5th component
= +
9
Fourier Theory
6th component
= +
10
Fourier Theory
1
= A sin(2 kt )
k 1 k
11
12
[Link]
Example: Music
• We think of music in terms of frequencies at different
magnitudes
13
Square Pulse-waveform and its first 2
components
14
Fourier Transform & Image Processing
• Fourier series and transform transform an image from the spatial domain to
the frequency domain.
• In this way, we examine the frequency components that make up the image,
not the brightness values of the pixels.
• Spatial domain: What's in the image? (e.g., edges, textures, objects)
• Frequency domain: How does the image change? (e.g., are there sudden or
slow transitions?)
• This can be used in areas such as noise reduction, edge detection, image
compression, and image filtering.
15
2D Fourier Transform
16
Discrete vs Continuous Fourier
17
2D Discrete Fourier Transform
18
2D Discrete Fourier Transform: Example
19
2D Discrete Fourier Transform: Example
20
Magnitude (Genlik) & Phase (Faz)
• Magnitude → Energy / Density information
• Phase → Structural / Spatial information
• Phase is the determining factor when reconstructing an image.
21
Fourier Transform of Impulse in Spatial Domain
A small change in the spatial domain
creates a large effect in the frequency
domain.
A point in space (an impulse) contains all
frequencies equally.
When two points in space are present, a
pattern (a sine wave) forms in the
frequency domain.
22
Fourier Transform Frequency Interpretation
The central part of the Fourier
Transform, i.e. the low frequency
components, represents the
overall gray level appearance of
an image.
The high frequency components
of the Fourier Transform
represent the detail information
of an image.
23
Fourier Transform Examples
• The transformation of the translated rectangle is the same as the
transformation of the original image.
• The transformation of the rotated rectangle is also rotated.
24
Fourier Transform Examples
• Signals can be added
+ =
A. Efros
25
Convolution Theorem
Convolution in the space domain = multiplication in the frequency
domain. Because some operations are difficult in the space
domain but easy in the frequency domain.
Convolution with a large filter (e.g., 50x50) takes a long time,
But if you take the Fourier transform → you only need to multiply
the two matrices.. 26
Fundamental Properties of the Fourier Transform
Linearity Translation
If you add two signals in the space Shifting an image in space (changing pixel
domain, their Fourier transforms are position) only changes the phase
added in the frequency domain. The information in the frequency domain, not
Fourier transform is a linear operation. the magnitude.
Image Processing: If multiple image Image Processing: If you shift an image
signals (for example, horizontal and to the right or up, the shape of the Fourier
vertical patterns) are combined, the spectrum does not change; only the phase
frequency components of these directions component changes. Therefore, the phase
appear together in the frequency domain. component carries the location
information.
27
Fundamental Properties of the Fourier Transform
Rotation Convolution Theorem
If you rotate the image in space, the Convolution (filtering) in the space domain
Fourier transform rotates by the same = multiplication in the frequency domain.
angle.
Image Processing: If you rotate an image Image Processing: Blurring an image with
by 45°, the spectrum in the frequency a Gaussian filter → Passes low
domain also rotates by 45°. Directional frequencies in the frequency domain
information in the frequency domain is without suppressing them. (blur ↔ low-
preserved. pass filter)
Correlation Theorem
Correlation (a measure of similarity) in the space
domain means multiplication with one inverted in
the frequency domain.
Image Processing: This is used in operations
such as template matching. When you search for
an object in an image, you correlate that object
with the image—this process can be done very
28
quickly in the Fourier domain.
Fourier Transform of Images
Red / yellow → high amplitude
Blue / black → low amplitude
D. Hoiem
29
Fourier Transform of Images
Filter Type What It Does Effect on Image
Keeps low frequencies, Blurs the image (smooths
Low-Pass Filter
removes high ones edges)
Keeps high frequencies, Sharpens the image (enhances
High-Pass Filter
removes low ones edges)
Keeps only certain frequency Highlights specific patterns or
Band-Pass Filter
ranges textures
D. Hoiem
Removes certain frequency Suppresses unwanted noise or
Band-Stop Filter
ranges patterns 30
Fourier Transform of Images
• Which has more
information:
• - phase or
• - magnitude?
• What happens if Amplitude
you take the
phase from one
image and
combine it with Phase
the magnitude
from another
image?
D. Hoiem
31
Fourier Transform of Images
Phase
Amplitude
D. Hoiem
32
Fourier Transform of Images
33
Frequency Domain Filtering
34
Frequency Domain Filtering
Remember spatial domain filtering:
Sobel
(vertical)
1 0 -1
2 0 -2
1 0 -1
* =
D. Hoiem
35
Frequency Domain Filtering
Frequency domain filtering:
FFT
FFT Inverse FFT
=
D. Hoiem
36
Frequency Domain Filtering
D. Hoiem
37
Frequency Domain Filtering
D. Hoiem
38
Frequency Domain Filtering
Box
Filter
D. Hoiem
39
Frequency Domain Filtering
Gaussian Filter
Gaussian give a nice smooth image, but the box filter give edgy artifacts.
D. Hoiem
40
Frequency Domain Filtering
Gaussian give a nice smooth image, but the box filter give edgy artifacts.
Gaussian Box
filter filter
D. Hoiem
41
Frequency Domain Filtering
Band pass filter can remove
repetitive noises
42
Frequency Domain Filtering
Band pass filter can remove repetitive noises
43
Frequency Domain Filtering
Low-pass filter:
A. Efros
44
Frequency Domain Filtering
Band-pass and High-pass
filters:
A. Efros
45
Frequency Domain Filtering
Edges in images:
A. Efros
46
Sampling
Sub-sampling by a factor of 2 :
D. Hoiem
The simplest way: discard all other rows and columns to create a
1/2 size image 47
Sampling
Aliasing Problem: 1D example sine wave.
S. Marschner
48
Sampling
Aliasing Problem:
• This occurs when the sampling rate is not high enough to
capture the amount of detail in the signal/image.
• It produces an incorrect signal/image—Alias
• Unwanted ripples, broken patterns, or flickering appear in
the image.
• The sampling rate should be high enough to capture the
highest frequencies in the image.
49
Sampling
Need to sample more.
S. Marschner
50
Sampling
• Subsampling can cause information loss.
• Traditional errors can occur:
• "Wagon wheels turn in the wrong direction in movies."
• "Striped shirts look funny on color television."
D. Forsyth
51
Sampling
• Subsampling can cause information loss.
• "Ray tracing breaks down the checkerboards."
A. Efros
52
Sampling
• Subsampling can cause information loss.
• "Striped shirts look funny on color TV."
A. Farhadi
53
Sampling
Algorithm for down-sampling by factor of 2
1. Start with image
2. Apply low-pass filter
im_blur = imfilter(image, fspecial(‘gaussian’,
7, 1))
3. Sample every other pixel
im_small = im_blur(1:2:end, 1:2:end);
D. Hoiem
54
Sampling
1/8
1/4
1/2
Steve Seitz
55
Sampling
Sub-sampling without pre-filtering
1/2 1/4 (2x zoom) 1/8 (4x zoom)
Steve Seitz
56
Sampling
Sub-sampling with Gaussian pre-filtering
Gaussian 1/2 Gaussian 1/4 (2x zoom) Gaussian 1/8 (4x zoom)
Steve Seitz
57