Keywords: front-page

## Lab: Circular Convolution Theorem

[Exercises] [Workspace]

Purpose: The purpose of this lab is to demonstrate the principle that linear and shift invariant filters can be implemented using either convolution or DFT tools.

Activities:

1. Images to be used in this experiment:

   Input: $DIP/data/lenina.kdf

   Kernel: $DIP/data/roberts_y.ascii

   1. Glyphs:Input/Output:Data Files:User defined
   2. Glyphs:Visualization:Non-Interactive Display:Display Image

2. First process the image in the spatial domain using LinearOp (Linear Operator). Since the kernel has negative values, convert the input image to float in order to support negative values in the resultant image. In the LinearOp (Linear Operator) choose "circular convolution".

   1. Glyphs:Data Manip:Data Conversion:Convert Type
   2. Glyphs:Arithmetic:Linear Transforms:LinearOp (Linear Operator)

3. Perform the same processing in the frequency domain.

   1. Take the DFT of the input image (unity scaling).

      1. Glyphs:Arithmetic:Linear Transforms:FFT

   2. Extend the kernel to the size of the input image. Use the Pad operator.

      1. Glyphs:Data Manip:Size & Region Operators:Pad

   3. Take the DFT of the padded kernel (unity scaling).

      1. Glyphs:Arithmetic:Linear Transforms:FFT

   4. Multiply both DFTs using Multiply.

      1. Glyphs:Arithmetic:Two Operand Arithmetic:Multiply

   5. Take the inverse DFT of the result of the multiplication. Select the option to scale the output by 1/N per transform axis.

      1. Glyphs:Arithmetic:Linear Transforms:FFT

   6. Due to numerical roundoff, the resultant image should be a real image. Verify that the imaginary part is very small. Discard the imaginary part of the resultant image using Complex to Real. Display the result.

      1. Glyphs:Arithmetic:Complex Operators:Complex to Real
      2. Glyphs:Arithmetic:Complex Operators:Imaginary Part
      3. Glyphs:Data Manip:Analysis & Information:Statistics
      4. Glyphs:Input/Output:Information:File Viewer
      5. Glyphs:Arithmetic:Complex Operators:Real Part
      6. Glyphs:Visualization:Non-Interactive Display:Display Image

   7. Compare the results of both types of filter processing using the Absolute Diff operator.

      1. Glyphs:Arithmetic:Two Operand Arithmetic:Absolute Diff
      2. Glyphs:Data Manip:Analysis & Information:Statistics
      3. Glyphs:Input/Output:Information:File Viewer
      4. Glyphs:Visualization:Non-Interactive Display:Display Image

Exercises

1. Repeat the same experiment using a different convolution kernel, e.g. 3x3 average kernel. Be careful with the kernel origin.

Khoros Workspace
Execute the visual program c6s2convolution-teo.wk