0% found this document useful (0 votes)
9 views80 pages

ImageProcessing Chap4

The document provides an overview of filtering in the frequency domain, including concepts such as the Fourier Transform, convolution, and various filtering techniques. It also covers the implementation of these concepts, including examples of discrete Fourier transforms and their properties. Additionally, it includes details about a mid-term exam scheduled for April 22nd.

Uploaded by

drumchrisp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views80 pages

ImageProcessing Chap4

The document provides an overview of filtering in the frequency domain, including concepts such as the Fourier Transform, convolution, and various filtering techniques. It also covers the implementation of these concepts, including examples of discrete Fourier transforms and their properties. Additionally, it includes details about a mid-term exam scheduled for April 22nd.

Uploaded by

drumchrisp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

(수강생을 제외하고, 해당 강의자료의 배포

및 무단 복제를 금함)

Chapter 4
Filtering in the Frequency Domain
(from 2nd +3rd editions of main
text)

Yung-Lyul Lee (이영렬)


http://home.sejong.ac.kr/~yllee/
Contents
Background
Introduction to the Fourier Transform and the Frequency Domain
Smoothing using Frequency-Domain Filters
Sharpening using Frequency Domain Filters
Homomorphic Filtering
Implementation

Mid-term exam: 4월 22일 13:30 ~14:40

2
Fourier series and Fourier transform
Weight3 x Any function that periodically repeats itself
can be expressed as the sum of
+ Weight2 x sines and/or cosines of different frequency,
each multiplied by a different coefficient
+ Weight1 x
=> Fourier series

f ( x) =  F [k ]e
k =−
jk0 x
, 0 = 2 u0
+ Weight0 x 
x(t ) =  X [k ]e
k =−
jk0t

Functions that are not periodic can


be expressed as the integral of
sines and/or cosines multiplied by a
weighing function
=> Fourier transform

 = 2 u

Spring 이영렬 3
Understanding frequency domain

◆ Fast Fourier Transform (FFT) algorithm revolutionized the fields of signal


processing
◆ Fourier techniques provide a meaningful and practical way to study and
implement many image enhancement approaches
4
1-D Fourier Transform and Inverse (1)
– Given single variable continuous function f(x)
– Fourier transform F(u) is given by


𝑋(𝑗𝜔) = න 𝑥(𝑡)𝑒 −𝑗𝜔𝑡 𝑑𝑡
−∞

– The inverse of the transform is given by 1 ∞


𝑥(𝑡) = න 𝑋(𝑗𝜔)𝑒 𝑗𝜔𝑡 𝑑𝜔
2𝜋 −∞

𝜔 = 2𝜋𝑢

– Extension of the transforms to two variables

5
Convolution
Convolution Theorem

 −u
 frequency

 t
t- = l

= F(u)H(u)

Spring 이영렬 6
Correlation theorem (Homework 3)
When f(t) has real number, compute Correlation theorem을 풀어서 제출하시오.

ℑ[𝑓(𝑡) • ℎ(𝑡)] = 𝐹[𝑓(𝑡) • ℎ(𝑡)]

by using F(u), H(u), F*(u), or H* (u)

𝑓 𝑡 •ℎ 𝑡

= න 𝑓 𝜏 ℎ 𝑡 + 𝜏 𝑑𝜏 여기에
−∞
수식을 입력하십시오.

Spring 이영렬 7
Discrete Space(Time) Fourier Transform (DSFT)
Fourier Transform Pair : +∞ +∞

𝑋(𝜔
ෝ1 , 𝜔
ෝ2 ) = ෍ ෝ 1 𝑛1 −𝑗𝜔
෍ 𝑥(𝑛1 , 𝑛2 )𝑒 −𝑗𝜔 𝑒 ෝ 2 𝑛2 
ෝ =2𝜋𝑢
𝑛1 =−∞ 𝑛2 =−∞


ෝ 1, 
ෝ 2 : discrete angular freq. 𝜋 𝜋
1 ෝ 1 𝑛1 𝑗𝜔
𝑥(𝑛1 , 𝑛2 ) = 2 න න 𝑋(𝜔 ෝ2 )𝑒 𝑗𝜔
ෝ1 , 𝜔 𝑒 ෝ 2 𝑛2 𝑑 𝜔
ෝ1 𝑑𝜔
ෝ2
4𝜋
−𝜋 −𝜋

1, 
X(ෝ ෝ 2) is in general complex; function of continuous variables and periodic :
1, 
X(ෝ ෝ 2) = X(ෝ 1 +2,  1, 
ෝ 2) = X(ෝ ෝ 2 +2).
1, 
X(ෝ ෝ 2) exists if x(n1,n2) is stable (absolute sum over entire n1,n2 space is finite)
Magnitude and Phase:

X (ˆ1 , ˆ 2 ) = F{x(n1 , n2 )}; x(n1 , n2 ) = F −1{ X (ˆ1 , ˆ 2 )}

𝑋(𝜔
ෝ1 , 𝜔
ෝ2 ) = 𝑋(𝜔 ෝ2 ) 𝑒 +𝑗𝜃 ;
ෝ1 , 𝜔 Polar form

ෝ 1 ,𝜔
Im{𝑋(𝜔 ෝ 2 )} ෝ 1 ,𝜔
Im 𝑋(𝜔 ෝ 2)
𝜃 = arctan ෝ 1 ,𝜔
ෝ 2 )}
= tan−1 Re{𝑋(𝜔
ෝ 1 ,𝜔
ෝ 2)
= 𝑎𝑟𝑔{𝑋 𝜔
ෝ1 , 𝜔
ෝ2 }
Re{𝑋(𝜔

Spring 이영렬 8
Example 4.1
Obtaining the Continuous-Time FT (CTFT) of a simple function

Text typo
 should be
changed to u ( frequency )
u 0
𝐴
= sin(𝜋𝑢W) zero crossings: 𝜋𝑢W= l 𝜋, l:integer
𝜋𝑢

= 𝐴𝑊 sin 𝑐 (𝑢𝑊)

What happens
if W increase :
If W decrease:

Spring 이영렬 9
Properties of DSFT
𝑋(𝜔 ෝ2 ) = 𝐹{𝑥(𝑛1 , 𝑛2 )}; 𝑥(𝑛1 , 𝑛2 ) = 𝐹 −1 {𝑋(𝜔
ෝ1 , 𝜔 ෝ1 , 𝜔
ෝ2 )}
Linearity FT
• ax(n1,n2) + by(n1,n2) <-> a X(1, 2) + b Y(1, 2)
IFT

Convolution
• x(n1,n2)**y(n1,n2) <-> X(1, 2) Y(1, 2)
DTFT

ෝ = 𝑋(𝑒 𝑗𝜔𝑛
𝑋 𝜔 )
Fourier Transform of Separable sequence
• x(n1,n2)=x1(n1)x2(n2) <-> X(1, 2) = X1(1)X2(2)
∞ ∞
2
෍ 𝑥(𝑛) = ෍ 𝑥(𝑛)𝑥(𝑛)∗
Parseval’s Theorem <proof> 𝑛=−∞ 𝑛=−∞
𝜋
∞ ∞ 𝜋 𝜋 1 ෝ
1 use 𝑥 ∗ (𝑛) = ( ෝ 𝑗𝜔𝑛
න 𝑋(𝜔)𝑒 ෝ ∗
𝑑𝜔)
෍ ෍ |𝑥(𝑛1 , 𝑛2 ) |2 = 2 න න |𝑋(𝜔 ෝ2 )|2 𝑑𝜔
ෝ1 , 𝜔 ෝ1 𝑑𝜔
ෝ2 2𝜋
4𝜋 −𝜋
𝑛1=−∞ 𝑛2=−∞ −𝜋 −𝜋
Proof in the 1-D case

10
Spring 이영렬 11
Example 1 of DSFT
n2 +∞ +∞
ෝ 1 𝑛1 −𝑗 𝜔
𝐻(𝜔
ෝ1 , 𝜔
ෝ2 ) = ෍ ෍ ℎ(𝑛1 , 𝑛2 )𝑒 −𝑗𝜔 𝑒 ෝ 2 𝑛2
h(n1,n2) 𝑛1 =−∞ 𝑛2 =−∞
1
ෝ1 ෝ2 ෝ1 ෝ2
1 2 1 = 2 + 𝑒 −𝑗𝜔 + 𝑒 −𝑗𝜔 + 𝑒 𝑗𝜔 + 𝑒 𝑗𝜔
n1
= 2{1 + cos( 𝜔
ෝ1 ) + cos( 𝜔
ෝ2 )}
1

--> Low pass filter !!!

ෝ 𝟏, 𝝎
What is magnitudes of | H(𝝎 ෝ 𝟐) |

LPF (H) 
(V)
-
Spring 이영렬 12
Example 2 of Fourier Transform
n2 This is separable h(n1,n2)=h1(n1)h2(n2) where,
h(n1,n2)
1 -3 1 3 h2(n2)
3 h1(n1)
-3 9 -3
n1
1 -3 1 n1 n2
-1 -1 -1 -1

H1(𝜔
ෝ1 )= 3 - 2cos(𝜔
ෝ1 ), H2(𝜔
ෝ2 )= 3 - 2 cos(𝜔
ෝ2 ); H (𝜔
ෝ1 , 𝜔
ෝ2 )= H1(𝜔
ෝ1 )H2(𝜔
ෝ2 )

ෝ 𝟏, 𝝎
What is magnitudes of | H(𝝎 ෝ 𝟐) | ?

HPF
(H)
(V)
Spring 이영렬 13
Let’s check what we have covered (1)
Box filter: 1/9[1 1 1; 1 1 1; 1 1 1]
HPF : [-1 -1 -1;-1 9 -1;-1 -1 -1]

(H) (V) (H) (V)

Spring 이영렬 14
Let’s check what we have covered (2)
Sobel(H): [-1 0 1;-2 0 2; -1 0 1]
Laplacian: [-1 -1 -1; -1 8 -1; -1 -1 -1]

(H) (V) (H) (V)

matlab> h=[-1 0 1;-2 0 2; -1 0 1] >>freqz2(h) 20 log10 𝐻(𝜔


ෝ1 , 𝜔
ෝ2 ) [𝑑𝐵]
Spring 이영렬 >>fvtool(h) 15
DTFT(1-D) vs. DSFT(2-D) vs. DFT
Concept same, but for implementation

continuous → F (u ) or F ( j )
f ( x) ⎯⎯
sampling
→ F (e jˆ )
f (n) ⎯⎯ : continuous periodic: 2𝜋 periodic on 𝜔
ෝ axis
sampling for digital computer: 2𝜋/N, 𝜔=
ෝ 2𝜋𝒖/N
F (u )
extracting one period and
f (n) ⎯⎯
→ F (u )
DFT
sampling

Spring 이영렬 16
Discrete Fourier Transform (DFT)
1D DFT
• For finite discrete sequence
𝑓(𝑛) for 𝑛 = 0, ⋯ , 𝑁 − 1
– Inverse DFT
𝑁−1
1 1
𝑓(𝑛) = ෍ 𝐹(𝑘)𝑊𝑁−𝑘𝑛 , 𝑛 = 0, ⋯ , 𝑁 − 1 𝑥[𝑛] = න ෝ
𝑋(𝑒 𝑗 𝜔 ෝ
)𝑒 𝑗 𝜔𝑛 𝑑𝜔

𝑁 2𝜋 <2𝜋>
𝑘=0
𝑓(𝑛) = 𝑓(𝑛 + 𝑁)
𝑤𝑁𝑁+𝑙 = 𝑤𝑁𝑙 , 0 ≤ 𝑙 < 𝑁
2𝜋
– Forward DFT (refer to DFT) ( 𝑤𝑁𝑁+𝑙 = (𝑒 −𝑗 𝑁 )𝑁+𝑙 = 𝑤𝑁𝑙 )
k=u
𝑁−1
frequency 𝐹(𝑘) = ෍ 𝑓(𝑛)𝑊𝑁𝑘𝑛 , 𝑘 = 0, ⋯ , 𝑁 − 1
𝑛=0 ∞
𝐹(𝑘) = 𝐹(𝑘 + 𝑁) ෝ
𝑋(𝑒 𝑗𝜔 ෝ
) = ෍ 𝑥[𝑛]𝑒 −𝑗𝜔𝑛
2𝜋
−𝑗 𝑛=−∞
where 𝑊𝑁 ≡ 𝑒 𝑁

Euler formula
2𝜋𝑘𝑛 2𝜋𝑘𝑛
𝐹(𝑘) = σ𝑁−1
𝑛=0 𝑓(𝑛)(cos − 𝑗 𝑠𝑖𝑛 )
𝑁 𝑁

17
DFT
Basis vectors
N −1 2 kn N −1 2 kn
Imaginary F ( k ) =  f ( n) sin Real F ( k ) =  f ( n) cos
n =0 N n =0 N
u=k, frequency u=k, frequency

If N=16

18
DFT (basis): orthogonal bases are usually used
Basis vectors: N=4 𝑁−1
1
𝐹(𝑘) = ෍ 𝑓(𝑛)𝑊𝑁𝑘𝑛
For 𝑁 = 4 𝑁
𝑛=0
𝐹(0) 1 1 1 1 𝑓(0)
𝐹(1) 1 1 𝑤41 𝑤42 𝑤43 𝑓(1)
= ⇒ 𝐅 = 𝐴𝐟 𝐯0 𝐓 𝐯1∗ = 1/16(1 + 𝑤4−1 + 𝑤4−2 + 𝑤4−3 ) = 0
𝐹(2) 4 1 𝑤42 𝑤40 𝑤42 𝑓(2)
𝐹(3) 1 𝑤43 𝑤42 𝑤41 𝑓(3) 1 (j) -1 (-j)
𝐯0 𝐓 𝐯2∗ = 1/16(1 + 𝑤4−2 + 𝑤40 + 𝑤4−2 ) = 0
Orthogonal? 2𝜋
⇒ easy to handle mathematically ..... −𝑗
𝑤4 = 𝑒 4
2𝜋
𝑤𝑁𝑁+𝑙 = 𝑤𝑁𝑙 , 0 ≤ 𝑙 < 𝑁 𝐯0 𝐓 𝐯0∗ =4/16=1/4 𝑤4−1 =𝑒 4 =𝑗 𝑗
2𝜋 4𝜋
( 𝑤𝑁𝑁+𝑙 = (𝑒 −𝑗 𝑁 )𝑁+𝑙 = 𝑤𝑁𝑙 ) −2 𝑗
𝑤4 = 𝑒 4 = −1
6𝜋
−3 𝑗
Norm is not 1 for each 4-dimensional vector 𝑤4 = 𝑒 4 = −𝑗
v0, v1, v2, v3: orthogonal vectors −𝑗
2𝜋
𝑊𝑁 ≡ 𝑒 𝑁
v0, v1, v2, v3: orthogonal vectors

N −1
1
Depending on applications F (k ) =
N
 f (n)W
n=0
kn
N , k = 0, , N −1

Norm =1 for each 4-dimensional vector


v0, v1, v2, v3: orthonormal vectors 𝑡𝑜 𝐯𝑖 𝐓 𝐯𝑗∗ =(i-j) 19
1-Dimensional DFT
▪ Fourier transform of a discrete function of one variable f(x)
x = 0, 1, 2,,,,,,M-1 (Discrete Fourier transform, or DFT)

Compare with slide 17

▪ Inverse DFT

▪ Euler’s formula

▪ Substituting into the expression for F(u) and noting that

20
Spring 이영렬
𝑁−1 𝑁−1 𝑁−1
1
෍ |𝑓 𝑥 |2 = ෍ 𝑓 𝑥 𝑓(𝑥)∗ = ⋯ = ෍ |𝐹 𝑢 |2
𝑥=0 𝑥=0
𝑁
𝑢=0
DFT Example

𝑁−1
2𝜋𝑢𝑥
−𝑗
𝐹 𝑢 = ෍𝑓 𝑥 𝑒 𝑁 , 𝑢 = 0, ⋯ , 𝑁 − 1, 𝑁 = 4 2𝜋𝑢𝑥
1 𝑁−1 𝑗 𝑁
𝑥=0 f(𝑥) = σ 𝐹(𝑢)𝑒 , 𝑥 = 0, ⋯ , 𝑁 − 1
𝑁 𝑢=0

Spring 이영렬 21
Parseval theorem
𝑁−1 𝑁−1

෍ |𝑓 𝑥 |2 = ෍ 𝑓 𝑥 𝑓(𝑥)∗
𝑥=0 𝑥=0

Spring 이영렬 22
1-D Fourier Transform and Inverse
Digital pixel Discrete

𝑀−1 𝐾−1
1 2𝜋𝑢𝑥 𝐴 2𝜋𝑢𝑥
𝐹(𝑢) = ෍ 𝑓(𝑥)𝑒 −𝑗 𝑀 = ෍ 𝑒 −𝑗 𝑀
𝑀 𝑀
𝑥=0 𝑥=0 M/K
𝐴 𝜋𝑢(𝐾−1) sin( 𝜋𝑢𝐾/𝑀) 𝑀
= 𝑒 −𝑗 𝑀 Zero crossing= ± 𝑙, 𝑙: 𝑖𝑛𝑡𝑒𝑔𝑒𝑟, 𝑙0
𝑀 sin( 𝜋𝑢/𝑀) 𝐾

Sum of geometric series

Homework 4

Spring 이영렬 23
2𝜋𝑢𝐾
2𝜋𝑢𝑥 −𝑗
1 𝑀−1 −𝑗 𝑀 𝐴 𝐾−1 −𝑗2𝜋𝑢𝑥 𝐴 1−𝑒 𝑀
𝐹 𝑢 = σ
𝑀 𝑥=0
𝑓 𝑥 𝑒 = σ
𝑀 𝑥=0
𝑒 𝑀 = 𝑀 −𝑗
2𝜋𝑢 =...
1−𝑒 𝑀
𝐴 −𝑗𝜋𝑢(𝐾−1) sin( 𝜋𝑢𝐾/𝑀) u ≠ 0, ±𝑀, ±2𝑀, … . .
= 𝑒 𝑀
𝑀 sin( 𝜋𝑢/𝑀)

Homework 4
1) 1D DFT를 유도하고
2) K=0에만 존재(f(x)=A(x))와 K가 M points인 경우 F(u)의 magnitude를
계산하고 그리시오.

Spring 이영렬 24
2-D DFT and Inverse

• In 2D, DFT of an image f(x, y) of dimensions M ☓ N is given by

Periodic Characteristics
y
• The inverse Fourier transform is given by (v)

x
(u)
• At point (0, 0)

which is the average of the entire image


= DC component of the spectrum

Spring 이영렬 25
Properties of the 2-D Fourier Transform (DFT)

u=100, v=400
• Separability

For all u, v

26

26
2-D DFT and Inverse

A − j  u (MK −1)  sin( uK / M ) 


likely F (u ) = e  
M  sin( u / M ) 

S=clog(1+r) (3.2-2)
Spring 이영렬 27
Filtering in Frequency Domain

Centered Fourier Spectrum

Spring 이영렬 28
Spatial Filtering in Frequency Domain
𝑁−1
2𝜋𝑢𝑥
Properties of 2D DFT (cont.): NN image 𝑓 𝑥 = ෍ 𝐹 𝑢 𝑒𝑗 𝑁 , → 𝑥 − 𝑥0
𝑢=0
– Translation Phase change (no change in magnitude) 𝑁−1
2𝜋𝑢(𝑥−𝑥0 )
𝑓 𝑥 − 𝑥0 = ෍ 𝐹 𝑢 𝑒 𝑗 𝑁
2𝜋 2𝜋 𝑢=0
𝑓(𝑥 − 𝑥0 , 𝑦 − 𝑦0 ) ⇔ 𝐹(𝑢, 𝑣) exp −𝑗 𝑢𝑥0 exp −𝑗 𝑣𝑦0 𝑁−1
𝑁 𝑁 −𝑗
2𝜋𝑢𝑥0
𝑗
2𝜋𝑢𝑥
Image shift = ෍𝐹 𝑢 𝑒 𝑁 𝑒 𝑁
𝑢=0
Shift in Frequency domain
2𝜋 2𝜋
𝑓(𝑥, 𝑦) exp 𝑗 𝑢 𝑥 exp 𝑗 𝑣 𝑦 ⇔ 𝐹(𝑢 − 𝑢0 , 𝑣 − 𝑣0 )
𝑁 0 𝑁 0 1
𝑁−1
2𝜋𝑢𝑥
𝐹(𝑢) = ෍ 𝑓(𝑥)𝑒 −𝑗 𝑁
𝑁
– Conjugate symmetry: For real 𝑓(𝑥, 𝑦) 𝑥=0
𝑢 −> 𝑢 − 𝑢0
𝐹 ∗ (𝑢, 𝑣) = 𝐹(−𝑢, −𝑣)

Magnitude: rotated by 180 because of |𝐹 𝑢, 𝑣 | = |𝐹 −𝑢, −𝑣 |

𝑁−1
Proof ∗
1 −𝑗
2𝜋(−𝑢)𝑥
𝐹 (𝑢) = ෍ 𝑓(𝑥) 𝑒 𝑁 = 𝐹(−𝑢)
𝑁
𝑛=0
𝐹 ∗ (𝑢, 𝑣) = 𝐹(−𝑢, −𝑣)

Spring 이영렬 29
Basic steps for filtering in frequency domain

• The following procedures:

1. Multiply input image by (-1)x+y to center the transform


2. Compute F(u, v), the DFT of the image from the previous step
[3. Multiply F(u, v) by a filter function H(u, v) if filtering is performed]
4. Compute inverse DFT of the result
5. Obtain the real part of the result in the step 4.
6. Multiply the result by (-1)x+y 2𝜋 2𝜋
𝑓(𝑥, 𝑦) exp −𝑗 𝑢0 𝑥 exp −𝑗 𝑣0 𝑦 ⇔ 𝐹(𝑢 + 𝑢0 , 𝑣 + 𝑣0 )
𝑁 𝑁
1: using
512512 image
2𝜋 2𝜋
𝑓(𝑥, 𝑦) exp 𝑗 𝑢0 𝑥 exp 𝑗 𝑣 𝑦 ⇔ 𝐹(𝑢 − 𝑢0 , 𝑣 − 𝑣0 )
𝑁 𝑁 0
𝑤ℎ𝑒𝑛 𝑢0 = 𝑣0 = 256 = 𝑁/2 (𝑁 = 512) Shift in Frequency domain
𝑓(𝑥, 𝑦)(−1)𝑥+𝑦 ⇔ 𝐹(𝑢 − 256, 𝑣 − 256)

Spring 이영렬 30
Spatial Filtering in Frequency Domain
Frequency mask

DFT

original image Image in Freq. domain invDFT

Image’ in Freq. domain Processed image

Freq. Mask

Spring 이영렬 31
Filtering in frequency domain

Spring 이영렬 32
Some basic filters and their properties

Low-pass filter(LPF)

High-pass filter(HPF)

Spring 이영렬 33
Correspondence between filtering in spatial
domain and frequency domain
Convolution in spatial domain  multiplication in frequency domain
f(x)*h(x)  F(u)H(u)
f(x,y)*h(x,y)  F(u,v)H(u,v) : convolution property
f(x,y)h(x,y)  F(u,v)*H(u,v) : multiplication property
Fourier
Transform

f(x) F(u)

* multiplication

h(x) H(u)

y[x] Y[u]

Spring 이영렬 34
Computing the inverse Fourier transform using a
forward transform algorithm
𝑀−1
1
𝐹(𝑢) = ෍ 𝑓(𝑥)𝑒 −𝑗2𝜋𝑢𝑥/𝑀 𝑢 = 0,1,2, . . . , 𝑀 − 1
𝑀
𝑥=0
𝑀−1

𝑓(𝑥) = ෍ 𝐹(𝑢)𝑒 𝑗2𝜋𝑢𝑥/𝑀 𝑥 = 0,1,2, . . . . , 𝑀 − 1


𝑢=0
𝑀−1
1 ∗ 1
𝑓 (𝑥) = ෍ 𝐹 ∗ (𝑢)𝑒 −𝑗2𝜋𝑢𝑥/𝑀
𝑀 𝑀
𝑢=0

𝑀−1 𝑁−1
1 ∗ 1
𝑓 (𝑥, 𝑦) = ෍ ෍ 𝐹 ∗ (𝑢, 𝑣)𝑒 −𝑗2𝜋(𝑢𝑥/𝑀+𝑣𝑦/𝑁)
𝑀𝑁 𝑀𝑁
𝑢=0 𝑣=0

Substituting F*(u,v) in an algorithm designed to compute the 2-D forward DFT,


fast inverse 2-D DFT can be computed
35

35
Period=400

Period=400

Without
-200+t t
padding ℎ(𝑥) ℎ(𝑥)

Wrap around error

36

36
300

𝑦 𝑛 = ෍ 𝑓𝑐 𝑚 ℎ𝑐 ( 𝑛 − 𝑚 )
𝑘=0

Zero padding

P ≥ A+B-1

padding
Period ≥ A+B-1

Circular convolution result


= Linear convolution result

Circular convolution is hard to implement, so


we usually use linear convolution.
This method is called linear convolution using 37

the DFT 37
Convolution
𝑁 𝑝𝑜𝑖𝑛𝑡𝑠 N + M −1
𝑓 𝑛 −> 𝑁 + 𝑀 − 1 𝑓𝑐 ′ 𝑛
N  insertion F (k)
𝑔(𝑛) −> 𝑁 + 𝑀 − 1 𝑔𝑐 ′ (𝑛) G(k)
𝑀 𝑝𝑜𝑖𝑛𝑡𝑠  insertion
M

ℑ−1 [𝐹 ′ (𝑘)𝐺 ′ (𝑘)] = 𝑓𝑐 ′ (𝑛) ⊗ 𝑔𝑐 ′ (𝑛)


= 𝑓(𝑛) ∗ 𝑔(𝑛)
ex) f(n) = {1,1, 2} 4points
g(n) = {2,1}
2

𝑦 𝑛 = ෍ 𝑓 𝑘 𝑔(𝑛 − 𝑘)
𝑦(𝑛) = 𝑓(𝑛) ∗ 𝑔(𝑛) = {2,3,5,2} 𝑘=0
3

= 𝑓𝑐 ′ (𝑛) ⊗ 𝑔𝑐 ′ (𝑛) = {2,3,5,2} 𝑦 𝑛 = ෍ 𝑓𝑐′ 𝑘 𝑔𝑐′((𝑛 − 𝑘))4


𝑘=0

Inside one period from equation


38
LPF after Zero Padding in Freq domain

P=2M, Q=2N

P=2M, Q=2N

g(x,y)
Spring 이영렬 39
Smoothing Frequency-Domain Filters
• Noise and sharp transitions are the high-frequency components
• Remove noise by attenuating the specified range of high frequency components
• Basic model of filtering in frequency domain
G(u, v) = H(u, v)F(u, v)
• Basic three types of low-pass filters, H(u, v)
➢ Ideal filter
➢ Butterworth filter
➢ Gaussian filter

𝑔(𝑥, 𝑦) = ℎ(𝑥, 𝑦) ∗ 𝑓(𝑥, 𝑦)

𝐺(𝑢, 𝑣) = 𝐻(𝑢, 𝑣)𝐹(𝑢, 𝑣)


𝑔(𝑥, 𝑦) = 𝐷𝐹𝑇 −1 [𝐻(𝑢, 𝑣)𝐹(𝑢, 𝑣)]

40
40
Ideal LPF(1)
G(u,v)=H(u,v)F(u,v)
Cut off all high frequency components of the Fourier transform that are at a
distance greater than a specified distance D0 from the origin
2D ideal low-pass filter (ILPF) with transfer function

Spring 이영렬 41
Ideal LPF(2)

Power(Energy) conservation
v = Au  || v ||2 =|| u ||2
N −1 N −1
( || v || =  | v(k ) | = u A Au = u u =  | u (n) |2 =|| u ||2 )
2 2 *T *T *T

k =0 *T n =0
Spring 이영렬
v v Unitary transform 42
Ideal LPF(3)

D0=5

h(x)

h(x,y) =DFT-1[H(u,v)]

Spatial domain ideal LPF


sinc function in time(spatial) domain → Rectangle in freq. domain

Spring 이영렬 43
Butterworth Lowpass Filter(1):BLPF
• Transfer function of a Butterworth lowpass filter (BLPF) of
order n with cutoff frequency D0 from the origin is defined as

D(u, v) is the distance


from the origin

n : shape control
If n is large, it looks like more rectangle

44

44
Butterworth Lowpass Filter(2) :BLPF
D0=5 BLPF in spatial domain; h(x,y)
n=1 n=2 n=5 n= 20

Looks like ILPF

Spatial domain representation


When cutoff freq. D0=5
larger n in freq domain (width smaller)
→ look at the zero crossings in pixel domain ( sinc(u) )
45
n=2 h(x,y) =DFT-1[H(u,v)]
45
Gaussian LPF(1): GLPF

D(u, v) is the distance from the origin (center of image). That is a


measure of spread of Gaussian curve

cutoff freq. D0

Spring 이영렬 46
Additional Examples of Gaussian LPF

Text of poor Text => GLPF


of pool
resolution with D₀=80
resolution => GLPF D₀=80
Frequency domain processing (GLPF) → spatial domain
47
(to bridge the small gaps in the input image by blurring it)
47
Gaussian LPF

주름제거

Spring 이영렬 48
Lowpass filters

Spring 이영렬 49
Sharpening Frequency Domain Filters(1)

• Image sharpening achieved


by highpass filtering process

• Attenuates the low frequency


components without
disturbing the high frequency
information in Fourier transform

50

50
Sharpening Frequency Domain Filters(2)

Spatial representation h(x,y) =DFT-1[H(u,v)] 51

51
Ideal Highpass Filter
• A 2D ideal highpass filter (IHPF) is defined as

Slide 40
52
Butterworth Highpass Filters
• Transfer function of a Butterworth highpass filter (BHPF) of
order n with cutoff frequency D0 from the origin is defined as

BLPF BHPF (u , v) = 1 − H (u , v)

n=2

53

53
Gaussian Highpass Filters
• Gaussian highpass filter (GHPF) in two dimensions is given by

− D 2 ( u ,v ) / 2 D02
H (u, v) = 1 − e

54

54
The Laplacian in the Frequency Domain(1)

𝑓(𝑥) = න 𝐹(𝑢)𝑒 𝑗2𝜋𝑢𝑥 𝑑𝑢
−∞

• The expression on the left side is the Laplacian of f(x, y) 𝜕𝑓(𝑥)
= න (𝑗2𝜋𝑢)𝐹(𝑢)𝑒 𝑗2𝜋𝑢𝑥 𝑑𝑢
𝜕𝑥
and we have [ 2 f ( x, y )] = −4 2 (u 2 + v 2 ) F (u, v) 𝜕 𝑚
−∞

( ) 𝑓(𝑥) ⇔ (𝑗2𝜋𝑢)𝑚 𝐹(𝑢)


𝜕𝑥
• Laplacian can be implemented in frequency domain by the filter
H (u , v) = −4 2 (u 2 + v 2 )

• Assume that the origin of F(u, v) is centered by performing the operation


before taking the transform
𝐻(𝑢, 𝑣) = −4𝜋 2 ((𝑢 − 𝑀/2)2 + (𝑣 − 𝑁/2)2 )

• Laplacian filtered image in spatial domain is obtained by


computing the inverse Fourier transform of H(u, v)F(u, v) as

 2 f ( x, y ) = −1[−4 2 ((u − M / 2) 2 + (v − N / 2) 2 ) F (u , v )]
 2 f ( x, y ) = −1[ H (u , v) F (u, v)] 55

55
The Laplacian in the Frequency Domain(2)
𝐻 𝑢, 𝑣 = −4𝜋 2 ((𝑢 − 𝑀/2)2 + (𝑣 − 𝑁/2)2 )

𝐻(𝑢, 𝑣); 𝐿𝑎𝑝𝑙𝑎𝑐𝑖𝑎𝑛

𝐹 −1 [𝐻(𝑢, 𝑣)]

56

56
The Laplacian in the Frequency Domain(3)
Spatial-domain image enhancement with the Laplacian

𝑔(𝑥, 𝑦) = 𝑓 𝑥, 𝑦 + 𝑐𝛻 2 𝑓(𝑥, 𝑦), where c=-1

Frequency-domain image enhancement with the Laplacian

𝑔 𝑥, 𝑦 = 𝐹 −1 {𝐹 𝑢, 𝑣 + 𝑐𝐻 𝑢, 𝑣 𝐹 𝑢, 𝑣 }

𝐻 𝑢, 𝑣 = −4𝜋 2 (𝑢2 + 𝑣 2 )
The Laplacian in the Frequency Domain(4)

58

58
Unsharp Masking, High-Boost Filtering, and High-Frequency
Emphasis Filtering(1)
◆ Frequency domain formulations of the unsharp masking and high boost
filtering for image sharpening techniques
• using frequency domain method

Unsharp masking when k=1


Highboost filtering when k>1

G 𝑢, 𝑣 = F(u,v)+k*(F(u,v)-𝐹𝐿𝑃 (𝑢, 𝑣)), 𝐹𝐿𝑃 𝑢, 𝑣 = 𝐻𝐿𝑃 (𝑢, 𝑣)𝐹(𝑢, 𝑣)


= [1 + 𝑘 ∗ [1 − 𝐻𝐿𝑃 (𝑢, 𝑣)]]𝐹(𝑢, 𝑣)

• Frequency domain computations involving a lowpass filter

𝑔(𝑥, 𝑦) = ℑ−1 {[1 + 𝑘 ∗ [1 − 𝐻𝐿𝑃 (𝑢, 𝑣)]]𝐹(𝑢, 𝑣)}


= ℑ−1 {[1 + 𝑘 ∗ 𝐻𝐻𝑃 (𝑢, 𝑣)]𝐹(𝑢, 𝑣)}

the result in terms of a highpass filter


A high-frequency emphasis filter 59
59
Unsharp Masking, High-Boost Filtering, and High-Frequency
Emphasis Filtering(2)

▪ General High-frequency emphasis filter

• Multiply high-pass filter by a constant and add an offset so that the DC term
is not eliminated by the filter

k1,k2  0

where k1 gives control of the DC offset from the origin and k2 controls the
contribution of high frequencies

60
High boost filtering in the frequency domain

61

61
High-frequency emphasis filtering

62

62
Homomorphic Filtering(1)

• Image f(x,y) can be expressed as the product of illumination


and reflectance components Illumination: low-frequency dominant
Reflectance: including some amount of high-frequency
components

Text is not good to understand

63
Homomorphic Filtering(2)

Text is not good to understand

64
Homomorphic Filtering(3)
𝑔(𝑚, 𝑛) = 𝑖 𝑚, 𝑛 𝑓(𝑚, 𝑛) , 𝑖(𝑚, 𝑛): 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑖𝑐𝑎𝑡𝑖𝑣𝑒 𝑛𝑜𝑖𝑠𝑒
ln 𝑔 (𝑚, 𝑛) = ln 𝑖 (𝑚, 𝑛) + ln 𝑓 (𝑚, 𝑛)
H(u,v): filter to remove I(u,v)
𝐹[ln 𝑔 (𝑚, 𝑛)] = 𝑍(𝑢, 𝑣) = 𝐼(𝑢, 𝑣) + 𝐹(𝑢, 𝑣) 0
𝑍 𝑢, 𝑣 𝐻 𝑢, 𝑣 = 𝐼 𝑢, 𝑣 𝐻 𝑢, 𝑣 + 𝐹 𝑢, 𝑣 𝐻 𝑢, 𝑣 −> 𝐼. 𝐹. 𝑇. → ln 𝑓′ (𝑚, 𝑛)

→ 𝑒 𝑙𝑛(𝑓 𝑚,𝑛 ) ≈ 𝑓′(𝑚, 𝑛)

❑ Example of homomorphic filtering


➢ For multiplicative noise or interference

i(m,n): known noise g(m,n): observed image f(m,n):original image


Homomorphic Filtering(3)

Gaussian HPF
When D(u,v)=0, ……………… 66
When D(u,v) is higher, ……….
Homomorphic Filtering(4)

67

67
Properties of the 2-D Fourier Transform (1)

• Translation

• Distributive law and scaling DFT: Linear

Proof in continuous domain

68
F 𝑢 = ‫׬‬−∞ 𝑓 𝑥 𝑒 −𝑗2𝑢𝑥 𝑑𝑥,


[f 𝑎𝑥 ] = න 𝑓 𝑎𝑥 𝑒 −𝑗2𝑢𝑥 𝑑𝑥, 𝑙𝑒𝑡 𝑎𝑥 = 𝑦
−∞

−𝑗2( )𝑦
𝑢
∞ 𝐹𝑇
1/𝑎 ‫׬‬−∞ 𝑓 𝑦 𝑒 𝑎 𝑑𝑦 , 𝑎 > 0 [f 𝑎𝑥 ] 1/ 𝑎 𝐹 𝑢/𝑎
[f 𝑎𝑥 ] = ൞
𝑦 𝑒 −𝑗2
𝑢
−∞ ( )𝑦
1/𝑎 ‫𝑓 ∞׬‬ 𝑎 𝑑𝑦, 𝑎 < 0

Spring 이영렬 69
Properties of the 2-D Fourier Transform (2)
𝑀−1
1
• Periodicity and conjugate symmetry 𝐹(𝑢) = ෍ 𝑓(𝑥)𝑒 −𝑗2𝜋𝑢𝑥/𝑀 𝑢 = 0,1,2, . . . , 𝑀 − 1
𝑀
𝑥=0

When f(x,y) is real function


F * (u , v) = F (−u , −v)
Magnitude : 180 rotated symmetry

70
Properties of the 2-D Fourier Transform (3)

71

71
Example 4.1

Slide 35
Spring 이영렬 72
Proof of (11)

F [cos(2 u0 x)] = ?
1 j 2  u0 x 1 − j 2  u 0 x 1
e + e  { (u − Mu0 ) +  (u + Mu0 )}
2 2 2
𝑀−1
Because 2𝜋𝑢𝑥
𝑓(𝑥) = ෍ 𝐹(𝑢)𝑒 𝑗 𝑀
1   (u ) 𝑢=0
𝑀−1
2  u0 x 1 −𝑗
2𝜋𝑢𝑥
j 𝐹(𝑢) = ෍ 𝑓(𝑥)𝑒 𝑀
e M
f ( x)  F (u − u0 ) 𝑀
𝑥=0
j 2  u0 x
𝑢 −> 𝑢 − 𝑢0
e f ( x)  F (u − Mu0 ) 𝑢 −> 𝑢 − 𝑀𝑢0

F [cos(2 u0 x + 2 v0 y )] = ?
1 j 2 u0 x j 2 v0 y 1 − j 2 u0 x − j 2 v0 y 1
e e + e e  { (u − Mu0 , v − Nv0 ) +  (u + Mu0 , v + Nv0 )}
2 2 2

Spring 이영렬 73
Convolution and correlation theorems
Convolution
1 M −1 N −1
f ( x, y ) * h ( x, y ) = 
MN m =0 n =0
f (m, n)h( x − m, y − n)

f ( x, y ) * h( x, y )  F (u , v) H (u , v)
f(x,y): real number
Correlation correlation : R (m, n) = E[ f ( x, y )h( x + m, y + n)]
M −1 N −1
1
f(x,y)  h(x,y ) =
MN
 f (m, n)h( x + m, y + n)
m =0 n =0

f ( x, y )  h( x, y )  F * (u , v) H (u , v)

Autocorrelation
f ( x, y )  f ( x, y )  F * (u , v) F (u , v) =| F (u , v) |2 74

74
Image correlation

𝑎 𝑏

𝑔(𝑥, 𝑦) = ෍ ෍ 𝑤(𝑠, 𝑡)𝑓(𝑥 + 𝑠, 𝑦 + 𝑡) , for all 𝑥, 𝑦


𝑠=−𝑎 𝑡=−𝑏

75

75
Study yourself from here
Chapter 4 End

Spring 이영렬 76
Discrete-Time Systems (1-D systems): Review of DSP
Filter = System
A filter is a system that is designed to remove some components or modify
some characteristics of a signal, but the two terms have same meaning.

A discrete-time system is a computational process for


transforming one sequence, called the input signal, into another
sequence called the output signal.

Spring 이영렬 77
Discrete-Time Systems (1-D systems)

A discrete-time system is a computational process for


transforming one sequence, called the input signal, into another
sequence called the output signal.

x[n] Discrete-Time y[ n] = {x[ n]}


Input System T[ ] Output

General FIR Filter

M
y[n] = b0 x[n] + b1 x[n − 1] + ... + bM x[n − M ] =  bk x[n − k ]
k =0

Spring 이영렬 78
Linear Time-Invariant(LTI) Systems
Time-invariant(TI) :
• A discrete-time system is said to be time-invariant if, when an input is delayed
by n0, the output is delayed by the same amount. That is, x[n-n0] -> y[n-no] if
x[n] -> y[n].

Linear : A discrete-time system is said to be linear if, the input consists of a sum
of scaled sequences, then the corresponding output is a sum of scaled outputs
corresponding to the individual input sequences.

x[n] = x1[n] + x2 [n]  y[n] = y1[n] + y2 [n]

Spring 이영렬 79
Examples (Self-test)

Check “time-invariance” and “linearity”

(1). y[n]={x[n]}2

(2). y[n] = x[n]+1

(3). y[n] = x[n-3]

(4). y[n] = nx[n]


M
(5). y[n] =  h[k ]x[n − k ]
k =0

Spring 이영렬 80

You might also like