Professional Documents
Culture Documents
Materi 06 Thinking in Frequency: Visi Komputer 2019/2020 - 2
Materi 06 Thinking in Frequency: Visi Komputer 2019/2020 - 2
Materi 06
Thinking in Frequency
Visi Komputer
2019/2020 - 2
Why does the Gaussian give a nice smooth
image, but the square filter give edgy artifacts?
Gaussian Box filter
1
Hybrid Images
3
Slide: Hoiem
Why does a lower resolution image still make
sense to us? What do we lose?
4
Image: http://www.flickr.com/photos/igorms/136916757/ Slide: Hoiem
Jean Baptiste Joseph Fourier (1768-1830)
...the manner in which the author arrives at these
had crazy idea (1807): equations is not exempt of difficulties and...his
Any univariate function can beanalysis to integrate them still leaves something to be
rewritten as a weighted sum of desired on the score of generality and even rigour.
sines and cosines of different
frequencies.
• Don’t believe it?
– Neither did Lagrange,
Laplace
Laplace, Poisson and
other big wigs
– Not translated into
English until 1878!
• But it’s (mostly) true!
– called Fourier Series Legendre
Lagrange
– there are some subtle
restrictions
6
A sum of sines
Our building block:
Asin(ωx + φ )
Add enough of them to get
any signal g(x) you want!
7
Frequency Spectra
• example : g(t) = sin(2πf t) + (1/3)sin(2π(3f) t)
= +
8
Slides: Efros
Frequency Spectra
9
Frequency Spectra
= +
10
Frequency Spectra
= +
11
Frequency Spectra
= +
12
Frequency Spectra
= +
13
Frequency Spectra
= +
14
Frequency Spectra
∞
1
= A∑ sin(2π kt )
k =1 k
15
Example: Music
• We think of music in terms of frequencies at
different magnitudes
16
Slide: Hoiem
Other signals
• We can also think of all kinds of other signals
the same way
xkcd.com 17
Fourier analysis in images
Intensity Image
Fourier Image
18
http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering
Signals can be composed
+ =
http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering
19
More: http://www.cs.unm.edu/~brayer/vision/fourier.html
Fourier Transform
• Fourier transform stores the magnitude and phase at each
frequency
– Magnitude encodes how much signal there is at a particular frequency
– Phase encodes spatial information (indirectly)
– For mathematical convenience, this is often notated in terms of real
and complex numbers
I (ω )
Amplitude: A = ± R(ω ) + I (ω )
2 2
Phase: φ = tan −1
R(ω )
20
The Convolution Theorem
• The Fourier transform of the convolution of two
functions is the product of their Fourier transforms
F[ g ∗ h] = F[ g ] F[h]
22
Filtering in spatial domain
1 0 -1
2 0 -2
1 0 -1
* =
24
Filtering in frequency domain
FFT
FFT
Inverse FFT
=
25
Slide: Hoiem
Filtering
Why does the Gaussian give a nice smooth
image, but the square filter give edgy artifacts?
Gaussian Box filter
27
Gaussian
28
Box Filter
29
Sampling
Why does a lower resolution image still make
sense to us? What do we lose?
30
Image: http://www.flickr.com/photos/igorms/136916757/
Sub sampling by a factor of 2
32
Source: S. Marschner
Aliasing problem
• 1D example (sinewave):
33
Source: S. Marschner
Aliasing problem
34
Source: D. Forsyth
Aliasing in video
35
Slide by Steve Seitz
Aliasing in graphics
36
Source: A. Efros
Sampling and aliasing
37
Nyquist-Shannon Sampling Theorem
• When sampling a signal at discrete intervals, the
sampling frequency must be ≥ 2 × fmax
• fmax = max frequency of the input signal
• This will allows to reconstruct the original
perfectly from the sampled version
v v v good
bad
38
Anti-aliasing
Solutions:
• Sample more often
39
Algorithm for downsampling by factor of 2
40
Anti-aliasing
41
Forsyth and Ponce 2002
Subsampling without pre-filtering
42
Slide by Steve Seitz
Subsampling with Gaussian pre-filtering
43
Slide by Steve Seitz
Why do we get different, distance-dependent
interpretations of hybrid images?
45
Salvador Dali invented Hybrid Images?
Salvador Dali
“Gala Contemplating the Mediterranean Sea,
46
which at 30 meters becomes the portrait
of Abraham Lincoln”, 1976
47
48
Clues from Human Perception
• Early processing in humans filters for various orientations and scales of
frequency
• Perceptual cues in the mid-high frequencies dominate perception
• When we see an image from far away, we are effectively subsampling it
51
Hybrid Image in FFT
52
Perception
Why do we get different, distance-dependent
interpretations of hybrid images?
53
Things to Remember
• Sometimes it makes sense to think of
images and filtering in the frequency
domain
– Fourier analysis
54
Practice question
1. Match the spatial domain image to the
Fourier magnitude image
1 2 3 4 5
A C E
D
55