View
237
Download
0
Category
Preview:
Citation preview
7/28/2019 Convolution Correlation
1/39
Todays Lecture :
Convolution and Correlation
Impulse response
Convolution in linear time-invariant systems
Properties of linear time-invariant systems
Convolution in images: the Gaussian filters
Break
Implementation of linear time-invariant systems
Correlation of discrete-time signals
Correlation in images
Local image enhancement
image and signal processing
itu copenhagen 1
7/28/2019 Convolution Correlation
2/39
Method for Analysis of a Discrete-Time
Linear Time-Invariant (LTI) System
Any input signal can be decomposed into the weighted sum of
unit sample sequences.
Analyze the linear, time-invariant (LTI) system by its response to
a unit sample signal system impulse response h(n).
The LTI system output for an arbitrary input signal is the con-
volution sum between the input signal and the system impulse
response h(n).
image and signal processing
itu copenhagen 2
7/28/2019 Convolution Correlation
3/39
Decompose a Discrete-Time Signal x(n)
Into a Sum of ImpulsesSelect elementary signal: time shifted impulses xk(n) = (n k).
Multiply x(n) and (n k): x(n)(n k) = x(k)(n k).
image and signal processing
itu copenhagen 3
7/28/2019 Convolution Correlation
4/39
Decompose a Discrete-Time Signal x(n)
Into a Sum of Impulses
The value of x(n) at position k can be obtained from
x(n)(n k).
In order to obtain the entire signal x(n) we simply sum the product
sequences for all possible k:
x(n) =
k=
x(k)(n k).
image and signal processing
itu copenhagen 4
7/28/2019 Convolution Correlation
5/39
The Convolution Sum
Define the response of a Linear, Time Invariant (LTI) system to the
unit sample signal (n):
h(n) [(n)]
Now use the arbitrary input signal represented as a sum of impulses
x(n) =
k=
x(k)(n k).
The LTI system output signal y(n) from the input signal x(n) is
y(n) = [x(n)].
Use the x(n) sum and the linearity condition of the LTI system
y(n) = [
k=
x(k)(n k))] =
k=
x(k)h(n k).
image and signal processing
itu copenhagen 5
7/28/2019 Convolution Correlation
6/39
The Convolution Sum Continued
Thus, the relaxed Linear, Time Invariant (LTI) system is completely
characterized by a single function h(n), which is the systems response
to the unit sample signal (n).
The LTI systems response to any input signal x(n) is the convolution
sum
y(n) =
k=x(k)h(n k) = x h.
image and signal processing
itu copenhagen 6
7/28/2019 Convolution Correlation
7/39
A Closer Look at the Convolution at Time
n0Compute the LTI system output at time n = n0,
y(n0) =
k=
x(k)h(n0 k).
From this we observe that:
The input signal x(k) and the impulse response h(n0k) are both
functions of k.
The signals x(k) and h(no k) are multiplied together to form a
new signal.
The output signal y(n0) is the sum of the elements of this product
signal.
image and signal processing
itu copenhagen 7
7/28/2019 Convolution Correlation
8/39
The Four Steps in Convolution
Computing the convolution between x(k) and h(k) to obtain the out-
put signal value y(n0), at time n = n0, involves the following four
steps
1. Folding Fold h(k) about k = 0 to obtain h(k).
2. Shifting Shift h(k) by n0 to obtain h(n0 k).
3. Multiplying Multiply x(k) by h(n0k) to obtain vn0 x(n)h(n0
k).
4. Summing Sum all the values of the product signal vn0(k) to obtain
the system output value y(n0) at time n = n0.
The complete system output signal y(n) for < n < is computed
by repeating Step 2, 3 and 4 for all time instants n.
image and signal processing
itu copenhagen 8
7/28/2019 Convolution Correlation
9/39
Convolution Example 2.3.2
image and signal processing
itu copenhagen 9
7/28/2019 Convolution Correlation
10/39
Properties of Convolution
Commutative x(n) h(n) = h(n) x(n)
y(n) =
k= x(k)h(n k) =
k= x(n k)h(k)
It does not matter which of the two signals that is folded and
shifted.
Associative [x(n) h1(n)] h2(n) = x(n) [h1(n) h2(n)]The input can be convolved with first one than the other impulse
response, or the impulse responses can be convolved with each
other first.
Distributive x(n) [h1(n) + h2(n)] = x(n) h1(n) + x(n) h2(n)If two LTI systems with impulse responses h1(n) and h2(n) are
excited by the same input, the sum of the responses is identical to
that of a LTI system with impulse response h(n) = h1(n) + h2(n).
image and signal processing
itu copenhagen 10
7/28/2019 Convolution Correlation
11/39
Causality of Linear Time-Invariant Systems
The output signal of a causal LTI system at time n0 does only depend
of the values of x(n) for n n0. What does that mean for the systems
impulse response h(n)?
y(n0) =
k=
h(k)x(n0 k)
=
k=0
h(k)x(n0 k) +1
k=
h(k)x(n0 k)
= (h(0)x(n0) + h(1)x(n0 1) + h(2)x(n0 2) + ) +
(h(1)x(n0 + 1 ) + h(2)x(n0 + 2 ) + h(3)x(n0 + 3 ) + ).
Now, if y(n0) is only dependent of past and present inputs then
h(n) = 0 for n < 0.
Thus the impulse response h(n) is 0 for n < 0. Nothing happens
before the input signal is applied.
image and signal processing
itu copenhagen 11
7/28/2019 Convolution Correlation
12/39
Causality of Linear Time-Invariant Systems
Now use a causal input x(n) to a LTI system h(n), then the limits in
the convolution sum is further restricted:
y(n) =n
k=0
h(k)x(n k)
=
nk=0
x(k)h(n k).
Notice that
the upper limit is growing with time, and
the output y(n) of a causal system, in response to a causal input,
is causal.
image and signal processing
itu copenhagen 12
7/28/2019 Convolution Correlation
13/39
Stability of Linear Time-Invariant Systems
A system is BIBO (bounded input, bounded output) stable if and
only if its output signal y(n) is bounded for every bounded input
x(n).
A linear time-invariant system is stable if its impulse response is
absolutely summable
k=
|h(k)| <
image and signal processing
itu copenhagen 13
7/28/2019 Convolution Correlation
14/39
Systems with Finite-Duration and
Infinite-Duration Impulse Responses FIR system:
Finite Impulse Response system such that h(n) = 0 for n < 0 and
n M.
y(n) =M1k=0
h(k)x(n k)
The system acts as a window, that views the most recent M inputsignal samples in forming the output. The FIR system has a finite
memory length of M samples.
IIR system: Infinite Impulse Response system.
y(n) =
k=0
h(k)x(n k)
The output uses the present and all past input samples, and thus
it has an infinite memory.
image and signal processing
itu copenhagen 14
7/28/2019 Convolution Correlation
15/39
Discrete 2D (Spatial) Convolution
f(x, y) h(x, y) =1
N M
M1m=0
N1n=0
f(m, n)h(x m, y n)
which is equivalent to our original definition of discrete 2D filtering.
The only difference is a flipping of the filter h about the origin.
g(x, y) =a
s=a
b
t=b
w(s, t)f(x + s, y + t)
This is a direct extension from the 1D convolution.
image and signal processing
itu copenhagen 15
7/28/2019 Convolution Correlation
16/39
Properties of convolutions
Besides the commutative, distributive and associative properties,
f g = g f
f (g + h) = f g + f h
f (g h) = (f g) h
the convolution result is limited and differentiable if one operand is.
In this case we have
D(f g) = Df g = f Dg
where D denotes differentiation.
image and signal processing
itu copenhagen 16
7/28/2019 Convolution Correlation
17/39
Gaussian Filter and Its Derivatives
This means we can get a smoothed differentiated image by convolving
the image with the derivative of a Gaussian function.
Important filters:
G(x, ) = 1(2)
12
e x2
22
Gx(x, ) = x
2G(x, )
Gxx(x, ) = (1
2
+x2
4
)G(x, )
Gxxx(x, ) = (3x
4
x3
6)G(x, )
. . .
image and signal processing
itu copenhagen 17
7/28/2019 Convolution Correlation
18/39
Gaussian Filters
From left to right: Original image, smoothed image by convolutionwith a Gaussian, blurred derivative in x-direction, burred derivative in
y-direction.
image and signal processing
itu copenhagen 18
7/28/2019 Convolution Correlation
19/39
Recursive Discrete-Time Systems
The output of a LTI system can be described explicitly in terms of
present and past values of the input. However past output values can
also be used in the description.
The cumulative average of a signal is y(n) = 1n+1 nk=0 x(k). Thecomputation of y(n) requires storage for samples x(k), 0 k n.
However we can use the previous output y(n 1):
(n + 1)y(n) =n1
k=0 x(k) + x(n) = ny(n 1) + x(n).
Hence y(n) = nn+1y(n 1) +
1n+1x(n).
The recursive system requires only one memory location.
image and signal processing
itu copenhagen 19
7/28/2019 Convolution Correlation
20/39
LTI Systems Described by Difference
Equations
Systems described by constant-coefficient linear difference equations
are a subclass of the recursive and nonrecursive systems.
The general form is
y(n) = N
k=1
aky(n k) +M
k=0
bkx(n k)
Recursive systems described by linear constant-coefficient differenceequations are linear and time invariant.
image and signal processing
itu copenhagen 20
7/28/2019 Convolution Correlation
21/39
Implementation of Linear Time-Invariant
Systems.
First order LTI system
y(n) = a1y(n 1) + b0x(n) + b1x(n 1).
Viewed as two LTI systems in cascade
FIR (Finite Impulse Response):
v(n) = b0x(n) + b1x(n 1)
and IIR (Infinite Impulse Response):
y(n) = a1y(n 1) + v(n).
We can interchange the order of two LTI filters without affecting the
overall system response (direct form II).
w(n) = a1w(n 1) + x(n)
y(n) = b0w(n) + b1w(n 1)
image and signal processing
itu copenhagen 21
7/28/2019 Convolution Correlation
22/39
General Linear Time-Invariant Recursive
System.
y(n) = N
k=1
aky(n k) +M
k=0
bkx(n k)
This can be written as a recursive system
w(n) =N
k=1
akw(n k) + x(n)
followed by a nonrecursive system (direct form II)
y(n) =M
k=0
bkw(n k)
image and signal processing
itu copenhagen 22
7/28/2019 Convolution Correlation
23/39
Direct Form II Structure.
image and signal processing
itu copenhagen 23
7/28/2019 Convolution Correlation
24/39
Direct Form II Structure.
The Direct Form II Structure requires:
The number of multiplications: M + N + 1.
The number of delays: max(M, N).
The Direct Form II structure requires a minimum number of delays
for the realization of the system, and is denoted a canonic form.
image and signal processing
itu copenhagen 24
7/28/2019 Convolution Correlation
25/39
Recursive and Nonrecursive Realizations of
FIR Systems
A FIR system is described by
y(n) = N
k=1
aky(n k) +M
k=0
bkx(n k).
A nonrecursive system has ak = 0 and the impulse response is the
filter coefficients bk.
A FIR system can always be realized both recursively and nonrecur-
sively.
FIR and IIR are general characteristics of a LTI system, recursive and
nonrecursive are structures for implementation of the system.
image and signal processing
itu copenhagen 25
7/28/2019 Convolution Correlation
26/39
Correlation of Discrete-Time Signals
Distance from radar to target:
x(n): Sampled version of the signal transmitted by the radar.
y(n): Sampled version of the signal reflected by the target (f.inst.
airplane, ship) and received by the radar.
Now assume the received signal y(n) is a delayed version of x(n)
y(n) = x(n D)
is an attenuation and D is the delay in samples out and home.
How can we determine the distance to the target?
Use correlation between the transmitted signal x(n) and the received
signal y(n)!
image and signal processing
itu copenhagen 26
7/28/2019 Convolution Correlation
27/39
Correlation of Discrete-Time Signals
The cross correlation between the finite energy signals x(n) and y(n)
rxy(k) =
n=
x(n)y(n k) k = 0,1,2, . . .
or equivalently y(n)
rxy(k) =
n=
x(n + k)y(n) k = 0,1,2, . . .
image and signal processing
itu copenhagen 27
7/28/2019 Convolution Correlation
28/39
Correlation of Discrete-Time Signals III
What happens if the order of x(n) and y(n) is reversed?
ryx(k) =
n=
y(n)x(n k)
=
n=
x(n k)y(n)
=
m=
x(m)y(m + k)
= rxy
(
k)
image and signal processing
itu copenhagen 28
7/28/2019 Convolution Correlation
29/39
Correlation
Cross correlation of x(n) and y(n): rxy(k) =
n= x(k)y(n k).
Shifting into y(n k).
Multiplying x(n) and y(n k).
Summing of product terms.
image and signal processing
itu copenhagen 29
7/28/2019 Convolution Correlation
30/39
Energy and Power of a Signal
The energy of a signal x(n) is defined as
E
n=
|x(n)|2
The average power of a signal is
P limx
1
2N + 1
N
n=N
|x(n)|2
image and signal processing
itu copenhagen 30
7/28/2019 Convolution Correlation
31/39
Autocorrelation
Correlation of a signal x(n) with itself.
rxx(k) =
n=
x(n)x(n k)
The signal energy is the autocorrelation for k = 0.
rxx(0) =
n=
x2(n)
image and signal processing
itu copenhagen 31
7/28/2019 Convolution Correlation
32/39
Properties of Auto- and Crosscorrelation
How are rxx(k), rxy(k) and ryy (k) related?
Look at the energy E(k) in the signal ax(n) + by(n k)
E(k) =
n=
(ax(n) + by(n k))2
= a2
n=
x2(n) + b2
n=
y2(n k) +
2ab
n=
x(n)y(n k)
= a2rxx(0) + b2ryy ( 0 ) + 2abrxy(k)
Now use that E(k) 0 k = 0,1,2, . . .
a2rxx(0) + b2ryy ( 0 ) + 2abrxy(k) 0
and dividing by b2, which is assumed = 0 gives
rxx(0)(a
b)2 + 2rxy(k)(
a
b) + ryy(0) 0
image and signal processing
itu copenhagen 32
7/28/2019 Convolution Correlation
33/39
Properties of Auto- and Cross-Correlation
E(k) is quadratic and nonnegative ina
b with coefficients rxx(0), 2rxy(k),and ryy(0)
rxx(0)
a
b
2+ 2rxy(k)(
a
b) + ryy (0) 0.
The discriminant
D = (2rxy(k))2 4rxx(0)ryy (0) = 4(rxy(k) rxx(0)ryy (0)) 0.
Condition on crosscorrelation
|rxy(k)| rxx(0)ryy(0) = ExEy.Condition on autocorrelation for y(n) = x(n)
|rxy(k)| rxx(0) = Ex
image and signal processing
itu copenhagen 33
7/28/2019 Convolution Correlation
34/39
Example of Autocorrelation
image and signal processing
itu copenhagen 34
7/28/2019 Convolution Correlation
35/39
Autocorrelation of Periodic Signals.
The autocorrelation of a periodic signal (power signal) is periodic.
rxx(k) = limx
1
2M + 1
Mn=M
x(n)x(n k)
Assume that x(n) is periodic with period P, then
rxx(k + P) = limx
1
2M + 1
Mn=M
x(n)x(n k P).
Because x(n k P) = x(n k)
rxx(k + P) = rxx(k)
image and signal processing
itu copenhagen 35
7/28/2019 Convolution Correlation
36/39
Periodicity in Sunspot Numbers.
image and signal processing
itu copenhagen 36
7/28/2019 Convolution Correlation
37/39
Spatial Correlation
Correlation can be used to find matches of a subimage w(x, y) in an
image f(x, y):
c(x, y) =
s
t
f(s, t)w(x + s, y + t)
The summation is taken over the region where the images overlap.
Compare it to filtering:
g(x, y) =a
s=a
bt=b
w(s, t)f(x + s, y + t)
image and signal processing
itu copenhagen 37
7/28/2019 Convolution Correlation
38/39
Local Enhancement by Histogram
Equalization
For each pixel, compute histogram in the neighborhood and obtain
histogram equalization. Map the gray level of the center pixel.
image and signal processing
itu copenhagen 38
7/28/2019 Convolution Correlation
39/39
Use of Histogram Statistics for Image
Enhancement
Find the local mean and variance of the gray levels in a neighborhood.Enhance areas where the local mean and variance differs a lot from
the global estimates.
image and signal processing
itu copenhagen 39
Recommended