SIGNAL PROCESSING
CONVOLUTION
Franck Dufrenois MISC
Convolution : applications
signal processing
s(t)
r(t)
d
Restauration of vinyls: removing of cracking
noises from soiled vinyl records Distance from the target plane: the signal r(t) is
noised and received with a delay with respect to
s(t)
Convolution: applications
image processing
Smoothing filter: low pass filter Enhancing filter : high pass filter Derivating filter
convolution: definition
It has a key role in continuous or discret signal. This operation is realized from a measuring tool
(microscope, camera, optical senses,..) which transforms or filters an input x(t) to an input y(t):
Convolution is defined by :
Continuous version
convolution: Impulse response
h(t) is named impulse response because it is the result of an input impulse signal 𝛿(𝑡)
The system is linear and invariant then the corresponding answer to
We have seen previously that:
The, we deduce that the overall response of the system
Intégrale de convolution
convolution: Graphical meaning
1 x(u) 1 x(u)
ℎ −0.25 − 𝑢 ℎ 0.5 − 𝑢
-0.5 -0.25 +0.5 -0.5 0 +0.5
+∞ +∞
න 𝑥 𝑢 ℎ −0.25 − 𝑢 𝑑𝑢 = 3/32 න 𝑥 𝑢 ℎ 0.5 − 𝑢 𝑑𝑢 = 1/8
−∞ −∞
x(u)
1 1 x(u)
ℎ 0−𝑢
-0.5 +0.5
-0.5 0 +0.5
h(u) h(-u) න
+∞
𝑥 𝑢 ℎ 0 − 𝑢 𝑑𝑢 = 1/8
+0.5 +0.5 −∞
-0.5 +0.5 -0.5 +0.5
convolution: properties
Cummutative operator
Associative operator
Distributive operator
- Convolution with dirac function:
convolution: link with Fourier transform
A filter can be defined in the frequency domain from the Fourier transform:
Let us define a system of impulse response h(t) and an input signal
The output is given by
+∞
(𝒚 𝒕 =න 𝒉 𝝉 𝒙 𝒕 − 𝝉 𝒅𝝉 )
−∞
Complex gain or Transfert function of the system
convolution: link with the Fourier transform
Consider a signal x(t) and its inverse Fourier transform:
Each component is corresponding to the output and by superposition
Then we deduce the Fourier transform
Convolution Product in the
⇋ In the time ⇋ frequency
domain domain
convolution: link with the Fourier transform
We have
Plancherel’s theorem
Proof
convolution: Plancherel’s theorem
We want to compute:
Take the Fourier transform
By computing the inverse Fourier transform, we obtain
convolution: digital version
Let us define : x=(x(1),x(2),…,x(k),…,x(N) ) a sampled signal and a filter h composed of M coefficients
: h=(h(1),h(2),…,h(j),…,h(M) ) with M<<N. Then the digital convolution (x*h)(n) is given by:
𝑀
𝐸[ 2 ]
1
𝑥∗ℎ 𝑛 = 𝑥 𝑛−𝑘 ℎ 𝑘 , 𝑛 = [0, … , 𝑁]
𝑀
𝑀
𝑘=−𝐸[ 2 ]
Remark: M will be odd (3,5,7,9,…) and bounds equals the lower integer part of M/2
𝒏=𝟐
Example:
𝒙 x(n-2) x(n-1) x(n) x(n+1) x(n+2) 𝑁=5
𝒉 𝒉(−1) ℎ(0) 𝒉(𝟏) 𝑀=3
𝑥 𝑛 + 1 ℎ −1 +𝑥 𝑛 ℎ 0 +𝑥 𝑛 − 1 ℎ +1
𝒌
convolution: example
𝑥(𝑛) ℎ(𝑛)
𝑛=0 𝑛=0
𝑥 ∗ ℎ 𝑛 : n=(1,2,3)
𝑥∗ℎ 𝑛 =1 𝑥∗ℎ 𝑛 =2 𝑥∗ℎ 𝑛 =3
convolution: boundaries
𝑥 ∗ ℎ 𝑛 : n=0? First option: zero padding
Management of the
extremities of the table? x 𝑥∗ℎ 𝑛
Second option: wrapping
𝒏=0
Third option: symmetry
fourth option: streching
convolution: Image
2D continuous version
Let us define x a continuous 2D signal and a 2D filter . Then the continuous 2D convolution 𝑥 ∗ 𝑦 𝜏, 𝜂
is defined by:
+∞ +∞
𝑥 ∗ ℎ 𝝉, 𝜼 = න න 𝑥 𝑢, 𝑣 ℎ 𝝉 − 𝑢, 𝜼 − 𝑣 𝑑𝑢 𝑑𝑣
−∞ −∞
2D digital version
Let us define x a discret time 2D signal of N*N samples and a 2D filter h of M*M coefficients, with M<<N.
2D digital convolution (x*h)(n,m) is given by:
𝑀 𝑀
𝐸[ 2 ] 𝐸[ 2 ]
1
𝑥 ∗ ℎ 𝒏, 𝒎 = 2 𝑥 𝒏 − 𝑘, 𝒎 − 𝑙 ℎ 𝑘, 𝑙 , (𝑛, 𝑚) = [0, … , 𝑁]
𝑀
𝑀 𝑀
𝑘=−𝐸[ 2 ] 𝑙=−𝐸[ 2 ] Matlab : z=conv2(x,h)
convolution: example
1 1
1
M=3: 𝑥 ∗ ℎ 𝒏, 𝒎 = 𝑥 𝒏 − 𝑘, 𝒎 − 𝑙 ℎ 𝑘, 𝑙 ,
9
𝑘=−1 𝑙=−1
𝒎 Image area filter
x(n-1,m-1) x(n-1,m) x(n-1,m+1) h(-1,-1) h(-1,0) h(-1,1)
𝒏
x(n, m-1) x(n,m) x(n,m+1) h(0, -1) h(0,0) h(0,1)
x(n+1, m-1) x(n+1,m) x(n+1,m+1) h(1, -1) h(1,0) h(1,1)
𝑥 ∗ ℎ 𝒏, 𝒎 = x(n+1,m+1).h(−1,−1)+x(n+1,m).h(−1,0)+ ⋯ .
𝟏/𝟗
convolution: example
(M=3)
original M=3 M=7
original