Keywords: front-page

# Convolution Principles

[Laboratory]

### Concepts of Linear Systems and Convolution

Discrete Convolution is a tool to build any linear and shift invariant filter. The equation for the convolution, g(x), of the sequence f(x) with the convolution kernel h(x) is

h(x) is also called the impulse response, Point Spread Function PSF, window kernel, window mask, window, filter, or template. This formula can be easily extended to the 2D case.

### Region of Support

We normally show the region of support of the convolution kernel. That is, the region where the kernel values are valid. The kernel values are zero outside the region of support.

There are two main types of convolution, depending on how we define the data: Linear Convolution and Circular Convolution.

1. For the 1D case, let f(x) and h(x) be infinite sequences, with region of support of length N for f(x) and M for h(x), meaning that outside the region of support all the data pointns are zero. Then the convolution g(x) is said to Linear Convolution. The resultant sequence g(x) will also be infinite with region of support of length M+N-1.
2. Again for the 1D case, if we define f(x) and h(x) as periodic sequences, with the same period N, then the convolution is said to be Circular Convolution. The resultant sequence g(x) will also be periodic with the same period N. In this case, outside the display of f(x), the data is periodically repeated, and outside the region of support of h(x), the data is zero extended up to the completion of one period with dimension N. Remember that h(x) is also periodic with same period as f(x).

Below are the illustrations on how the sequences are represented in both cases:

a)original image f; b)kernel h
a) | b)

a)zero outside (for linear convolution); b)periodic (for circular convolution)
a) | b)

a)3x3 kernel for linear convolution; b)3x3 kernel for circular convolution (periodic with same period as the image)
a) | b)

### Origin of a Convolution Kernel

When we define a convolution kernel, we do not always we have the origin of its coordinates positioned at the top left corner of its region of support. Normally, there is a shift in the resultant image if the origin of the convolution kernel is not at the center of its region of support. A simple name for the origin is "sweet spot".

### Simple Examples of Convolution

- Shifted kernel: h(2,2)=1

  a)Original; b)kernel
  a) | b)

  a)Linear Convolution (Note the output size: 2 wider, 2 higher); b)Circular Convolution (Note the output with same size)
  a) | b)

- Averaging with 3x3 Kernel

  a)Original; b)average kernel
  a) | b)

  a)Linear convolution. Note that the top left coordinates should be (-1,-1) since the kernel has negative coordinates; b)Circular Convolution
  a) | b)

- Sobel X-direction

  a)Original; b)Sobel kernel
  a) | b)

  a)Linear convolution. Note that the top left coordinates should be (-1,-1) since the kernel has negative coordinates; b)Circular convolution
  a) | b)

Observe that if there is an isolated point (impulse) in the input image then the kernel appears reproduced in the filtered or output image.

- Lab: Convolution Principles