Docsity

Convolution in Mathematics of Image Processing: Formulas and Examples, Assignments of Mathematics

Toggle sidebar
bg1
Mathematics of Image Processing
Worksheet #4 - Convolution
Name: Box #:
Circular convolution Let fand gbe two signals with Nsamples each.
The circular convolution of fand gis the npoint sample given by:
f∗g(k) =
N−1
X
r=0
f(k−r)g(r) =
N−1
X
r=0
f(r)g(k−r) (mod N)
The mod Nmeans that we use clock arithmetic in computing k−r, or that we
assume that fand gare defined for all integers , but are periodic with period N,
i.e., f(k+N) = f(k), g(k+N) = g(k).For example, suppose that N= 4 and
that fand gare defined by vectors [x0, x1, x2, x3] and [y0, y1, y2, y3] :
f(r) = xrmod 4, g(r) = yrmod 4.
Then
f∗g(0) =
3
X
r=0
f(−r)g(r) = f(0)g(0) + f(−1)g(1) + f(−2)g(2) + f(−3)g(3)
=f(0)g(0) + f(3)g(1) + f(2)g(2) + f(1)g(3)
=x0y0+x3y1+x2y2+x1y3
f∗g(1) = x1y0+x0y1+x3y2+x2y3
f∗g(2) = x2y0+x1y1+x0y2+x3y3
f∗g(3) = x3y0+x2y1+x1y2+x0y3
1. Let N= 8, f(0) = 1
2,f(1) = 1
2f(r) = 0 otherwise. Let gbe defined by
an arbitrary vector [y0, y1, . . . , y7].Find the formulas (for eight samples) for
pf3
pf4
pf5

Partial preview of the text

Download Convolution in Mathematics of Image Processing: Formulas and Examples and more Assignments Mathematics in PDF only on Docsity!

Mathematics of Image Processing

Worksheet #4 - Convolution

Name: Box #:

Circular convolution Let f and g be two signals with N samples each.

The circular convolution of f and g is the n point sample given by:

f ∗ g(k) =

N∑ − 1

r=

f (k − r)g(r) =

N∑ − 1

r=

f (r)g(k − r) (mod N )

The mod N means that we use clock arithmetic in computing k − r, or that we

assume that f and g are defined for all integers , but are periodic with period N ,

i.e., f (k + N ) = f (k), g(k + N ) = g(k). For example, suppose that N = 4 and

that f and g are defined by vectors [x 0 , x 1 , x 2 , x 3 ] and [y 0 , y 1 , y 2 , y 3 ] :

f (r) = xr mod 4, g(r) = yr mod 4.

Then

f ∗ g(0) =

3 ∑

r=

f (−r)g(r) = f (0)g(0) + f (−1)g(1) + f (−2)g(2) + f (−3)g(3)

= f (0)g(0) + f (3)g(1) + f (2)g(2) + f (1)g(3)

= x 0 y 0 + x 3 y 1 + x 2 y 2 + x 1 y 3

f ∗ g(1) = x 1 y 0 + x 0 y 1 + x 3 y 2 + x 2 y 3

f ∗ g(2) = x 2 y 0 + x 1 y 1 + x 0 y 2 + x 3 y 3

f ∗ g(3) = x 3 y 0 + x 2 y 1 + x 1 y 2 + x 0 y 3

  1. Let N = 8, f (0) =

1 2

, f (1) =

1 2

f (r) = 0 otherwise. Let g be defined by

an arbitrary vector [y 0 , y 1 ,... , y 7 ]. Find the formulas (for eight samples) for

f ∗ g.             y 0 +y 7 2 y 1 +y 0 2 y 2 +y 1 2 y 3 +y 2 2 y 4 +y 3 2 y 5 +y 4 2 y 6 +y 5 2 y 7 +y 6 2

  1. Find a matrix Hf such that

f ∗ g(0)

f ∗ g(1)

. . .

f ∗ g(7)

= Hf Y = Hf

y 0

y 1

. . .

y 7

Hf =

  1. Now let N = 8, f (7) = x 7 , f (0) = x 0 , f (1) = x 1 , f (r) = 0 otherwise. Now

write out the matrix for Hf.

Hf =

x 0 0 0 0 0 0 0 x 1

x 1 x 0 0 0 0 0 0 0

0 x 1 x 0 0 0 0 0 0

0 0 x 1 x 0 0 0 0 0

0 0 0 x 1 x 0 0 0 0

0 0 0 0 x 1 x 0 0 0

0 0 0 0 0 x 1 x 0 0

0 0 0 0 0 0 x 1 x 0

  1. Compute F (z), G(z), H(z), and F (z)G(z), Reduce the exponents of F (z)G(z)

mod 4 and compare to H(z). What do you observe?

F (z) = a 0 +

a 1

z

a 2

z^2

a 3

z^3

G(z) = b 0 +

b 1

z

b 2

z

2

b 3

z

3

H(z) = a 0 b 0 + a 1 b 3 + a 2 b 2 +

a 3 b 1 + a 0 b 1 + a 1 b 0 + a 2 b 3 + a 3 b 2

z

a 0 b 2 + a 1 b 1 + a 2 b 0 + a 3 b 3

z

2

a 0 b 3 + a 1 b 2 + a 2 b 1 + a 3 b 0

z

3

F (z)G(z) =

a 0 +

a 1

z

a 2

z^2

a 3

z^3

b 0 +

b 1

z

b 2

z^2

b 3

z^3

= a 0 b 0 +

a 1 b 0 + a 0 b 1

z

a 2 b 0 + a 1 b 1 + a 0 b 2

z^2

a 3 b 0 + a 2 b 1 + a 1 b 2 + a 0 b 3

z^3

a 3 b 1 + a 2 b 2 + a 1 b 3

z

4

a 3 b 2 + a 2 b 3

z

5

a 3 b 3

z

6

Reduce exponents mod 4 to get

a 0 b 0 +

a 1 b 0 + a 0 b 1

z

a 2 b 0 + a 1 b 1 + a 0 b 2

z

2

a 3 b 0 + a 2 b 1 + a 1 b 2 + a 0 b 3

z

3

a 3 b 1 + a 2 b 2 + a 1 b 3

a 3 b 2 + a 2 b 3

z

a 3 b 3

z^2

= a 0 b 0 + a 2 b 2 + a 1 b 3 + a 3 b 1 +

a 1 b 0 + a 0 b 1 + a 3 b 2 + a 2 b 3

z

a 3 b 3 + a 2 b 0 + a 1 b 1 + a 0 b 2

z^2

a 3 b 0 + a 2 b 1 + a 1 b 2 + a 0 b 3

z^3

= H(z)

  1. Based on previous questions give a short argument about why

f̂ ∗ g = f̂ ̂g

as functions. Since F (z)G(z) is the same as H(z) when the exponentsare

reduced mod 4 then

F (z)G(z) = H(z), if z

4 = 1.

But then

f̂ ∗ g(k) = H(e^2 πi^

k (^4) )

= F (e

2 πi k 4 )G(e

2 πi k 4 )

= f̂ (k)̂g(k).