Convolution Correlation
Convolution Correlation
Convolution Correlation
Impulse response Convolution in linear time-invariant systems Properties of linear time-invariant systems Convolution in images: the Gaussian lters Break Implementation of linear time-invariant systems Correlation of discrete-time signals Correlation in images Local image enhancement
image
and
signal
processing
itu
copenhagen
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 convolution sum between the input signal and the system impulse response h(n).
image
and
signal
processing
itu
copenhagen
image
and
signal
processing
itu
copenhagen
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
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= image and
x(k) (n k))] =
k= processing
x(k)h(n k).
signal
itu
copenhagen
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
y (n0) =
k=
x(k)h(n0 k).
From this we observe that: The input signal x(k) and the impulse response h(n0 k) 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
image
and
signal
processing
itu
copenhagen
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 rst one than the other impulse response, or the impulse responses can be convolved with each other rst. 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
y (n0) =
k=
h(k)x(n0 k)
1
=
k=0
h(k)x(n0 k) +
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 f or 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
Now use a causal input x(n) to a LTI system h(n), then the limits in the convolution sum is further restricted:
n
y (n) =
k=0 n
= 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
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
|h(k)| <
k=
image
and
signal
processing
itu
copenhagen
13
y (n) =
k=0
h(k)x(n k)
The system acts as a window, that views the most recent M input signal samples in forming the output. The FIR system has a nite memory length of M samples. IIR system: Innite 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 innite memory.
image and signal processing itu copenhagen 14
1 M 1 N 1 f (m, n)h(x m, y n) f (x, y ) h(x, y ) = N M m=0 n=0 which is equivalent to our original denition of discrete 2D ltering. The only dierence is a ipping of the lter h about the origin.
a b
g (x, y ) =
s=a t=b
w(s, t)f (x + s, y + t)
image
and
signal
processing
itu
copenhagen
15
Properties of convolutions
Besides the commutative, distributive and associative properties, f g = gf f (g + h) = f g + f h f (g h) = (f g ) h
the convolution result is limited and dierentiable if one operand is. In this case we have D(f g ) = Df g = f Dg where D denotes dierentiation.
image
and
signal
processing
itu
copenhagen
16
image
and
signal
processing
itu
copenhagen
17
Gaussian Filters
From left to right: Original image, smoothed image by convolution with a Gaussian, blurred derivative in x-direction, burred derivative in y-direction.
image
and
signal
processing
itu
copenhagen
18
However we can use the previous output y (n 1): 1 (n + 1)y (n) = n k=0 x(k ) + x(n) = ny (n 1) + x(n).
n y (n 1) + 1 x(n). Hence y (n) = n+1 n+1
image
and
signal
processing
itu
copenhagen
19
Systems described by constant-coecient linear dierence equations are a subclass of the recursive and nonrecursive systems. The general form is
N M
y (n) =
k=1
ak y (n k) +
k=0
bk x(n k)
Recursive systems described by linear constant-coecient dierence equations are linear and time invariant.
image
and
signal
processing
itu
copenhagen
20
y (n) =
k=1
ak y (n k) +
k=0
bk x(n k)
w(n) =
k=1
ak w(n k) + x(n)
y (n) =
k=0
bk w(n k)
image
and
signal
processing
itu
copenhagen
22
image
and
signal
processing
itu
copenhagen
23
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
y (n) =
k=1
ak y (n k) +
k=0
bk x(n k).
A nonrecursive system has ak = 0 and the impulse response is the lter coecients bk . A FIR system can always be realized both recursively and nonrecursively. 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
The cross correlation between the nite 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=
k = 0, 1, 2, . . .
image
and
signal
processing
itu
copenhagen
27
ryx(k) =
n=
= =
x(m)y (m + k)
m=
= rxy (k)
image
and
signal
processing
itu
copenhagen
28
Correlation
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
E
n=
|x(n)|2
image
and
signal
processing
itu
copenhagen
30
Autocorrelation
rxx(k) =
n=
x(n)x(n k)
rxx(0) =
n=
x2(n)
image
and
signal
processing
itu
copenhagen
31
E (k) = =
n= a2 n=
y 2 (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 a a rxx(0)( )2 + 2rxy (k)( ) + ryy (0) 0 b b
image and signal processing itu copenhagen 32
image
and
signal
processing
itu
copenhagen
33
Example of Autocorrelation
image
and
signal
processing
itu
copenhagen
34
image
and
signal
processing
itu
copenhagen
35
image
and
signal
processing
itu
copenhagen
36
Spatial Correlation
f (s, t)w(x + s, y + t)
The summation is taken over the region where the images overlap. Compare it to ltering:
a b
g (x, y ) =
s=a t=b
w(s, t)f (x + s, y + t)
image
and
signal
processing
itu
copenhagen
37
image
and
signal
processing
itu
copenhagen
38
image
and
signal
processing
itu
copenhagen
39