0% found this document useful (0 votes)
36 views

EEL 6562 Image Processing & Computer Vision Linear and Circular Convolution Example

1) Linear convolution is defined as the summation of one function multiplied by the other function shifted over various indices. It produces a result that is the length of the two input functions added together minus one. 2) Circular convolution treats the input functions as circular and uses modulo arithmetic to shift one function to multiply with the other. It produces a result that is the same length as the input functions. 3) Linear convolution can be modeled as a circular convolution by zero-padding the input functions to be the same length as produced by the linear convolution. This allows the same calculation to be used in both cases.

Uploaded by

namhoa02
Copyright
© Attribution Non-Commercial (BY-NC)
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)
36 views

EEL 6562 Image Processing & Computer Vision Linear and Circular Convolution Example

1) Linear convolution is defined as the summation of one function multiplied by the other function shifted over various indices. It produces a result that is the length of the two input functions added together minus one. 2) Circular convolution treats the input functions as circular and uses modulo arithmetic to shift one function to multiply with the other. It produces a result that is the same length as the input functions. 3) Linear convolution can be modeled as a circular convolution by zero-padding the input functions to be the same length as produced by the linear convolution. This allows the same calculation to be used in both cases.

Uploaded by

namhoa02
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 5

EEL 6562 Image Processing & Computer Vision Linear and Circular Convolution Example

Linear Convolution
One dimensional linear discrete convolution is dened as:

g (x) =
s=

f (s) h(x s) = f (x) h(x)

For example, consider the convolution of the following two functions:

3 1

f (x ) 1 2 3 -2 1 1

h (x )

0 1

0 1 2 3

This convolution can be performed graphically by reecting and shifting h(x), as shown in Figure 1. The samples of f (s) and h(s x) that line up vertically are multiplied and summed: g (0) = f (1)h(1) + f (0)h(0) = 0 + 1 = 1 g (1) = f (0)h(1) + f (1)h(0) = 1 + 3 = 4 g (2) = f (1)h(1) + f (2)h(0) = 3 + 2 = 1 g (3) = f (2)h(1) + f (3)h(0) = 2 + 1 = 1 g (4) = f (3)h(1) + f (4)h(0) = 1 + 0 = 1 The result of the convolution is as shown below:

4 g (x ) 1 1 3 0 1 2 -1
Notice that when f (x) is of length 4, and h(x) is of length 2, the linear convolution is of length 4 + 2 1 = 5.

1 4

Circular Convolution
One dimensional circular discrete convolution is dened as:
M 1

g (x) =
s=0

f (s) h((x s) mod M ) = f (x)

h(x)

For M = 4, the convolution can be performed using circular reection and shifts of h(x), as shown in Figure 2. The samples of f (s) and h((s x) mod M ) that line up vertically are multiplied and summed: g (0) = f (3)h(1) + f (0)h(0) = 1 + 1 = 2 g (1) = f (0)h(1) + f (1)h(0) = 1 + 3 = 4 g (2) = f (1)h(1) + f (2)h(0) = 3 + 2 = 1 g (3) = f (2)h(1) + f (3)h(0) = 2 + 1 = 1 The result of the convolution is as shown below:

4 2 g (x ) 1 3 0 1 2 -1
Notice that f (x) and h(x) are both treated as if they are of length 4, and the circular convolution is also of length 4.

Linear Convolution as Circular Convolution


If f (x) and g (x) are both treated as if they are of length 4 + 2 1 = 5, then the following circular convolution is calculated: g (0) = f (4)h(1) + f (0)h(0) = 0 + 1 = 1 g (1) = f (0)h(1) + f (1)h(0) = 1 + 3 = 4 g (2) = f (1)h(1) + f (2)h(0) = 3 + 2 = 1 g (3) = f (2)h(1) + f (3)h(0) = 2 + 1 = 1 g (4) = f (3)h(1) + f (4)h(0) = 1 + 0 = 1 This procedure is called zero padding. Notice that this circular convolution matches the linear convolution. In general, if f (x) has length A, and h(x) has length B , and both f (x) and h(x) are zero padded out to length C , where C A + B 1, then the C -point circular convolution matches the linear convolution.

3 1

f (s) 1 2 3 4 -2 1

f (s) 1 2 3 4 -2 1

f (s) 1 2 3 4 -2

-1 0 1

-1 0 1

-1 0 1

1 1 -1 0 1 2 3 4 h(0 s) 3 1 2 -1 0 1 -2

1 1 -1 0 1 2 3 4 h(1 s) f (s) 1 3 4 1 2 -1 0 1 -2 3

1 1 -1 0 1 2 3 4 h(2 s) f (s) 1 3 4

1 1 -1 0 1 2 3 4 h(3 s)

1 1 -1 0 1 2 3 4 h(4 s)

Figure 1: Linear convolution by the graphical method.

3 1

f (s) 1 2 3 -2 1

f (s) 1 2 3 -2

0 1

0 1

1 1 0 1 2 3 h((1 s) mod 4) 3 1 2 0 1 -2 1 1 0 1 2 3 h((3 s) mod 4) f (s) 1 3

0 1 2 3 h((0 s) mod 4) 3 1 2 0 1 -2 1 1 0 1 2 3 h((2 s) mod 4) 3 f (s) 1

Figure 2: Circular convolution using the graphical method.

You might also like