Keywords: front-page

## Lab: DFT: Filtering in the Frequency Domain

[Exercises] [Workspace]

Purpose: The purpose of this lab is to experiment with frequency domain filtering using ideal filters.

Activities:

1. Create a vertical binary image using a sinusoidal signal in the width direction, followed by a comparison operator to threshold. Display the result. Use the operators Sinusoid, >= (greater than or equal), and Display Image.

   1. Glyphs:Input/Output:Generate Data:Sinusoid
   2. Glyphs:Arithmetic:Comparison Operators:>=
   3. Glyphs:Visualization:Non-Interactive Display:Display Image

2. Use the Low-Pass, High-Pass, and Band-Pass operators to design "ideal" filters. These filters should have the same dimensions as the image you created in Step 1. Display the filters. When specifying the cutoff frequencies for the filter design operators, specify a value which is the desired frequency filter radius, in pixels, divided by the dimension.

   1. Low-Pass: Filter out all primitives greater than 8 pixels

      1. Glyphs:Image Proc:Frequency Filter:Low-Pass
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

   2. High-Pass: Filter out all frequencies with a period less than 8 pixels

      1. Glyphs:Image Proc:Frequency Filter:High-Pass
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

   3. Band-Pass: Allow only those cosine components with periods between 7 and 8 pixels to pass (7 <= T <= 8) to pass.

      1. Glyphs:Image Proc:Frequency Filter:Band-Pass
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

3. Take the forward Fourier transform of the image and multiply it by each filter. Use operators FFT and Multiply. Use "Unity Scaling".

   1. Glyphs:Arithmetic:Linear Transforms:FFT
   2. Glyphs:Arithmetic:Two Operand Arithmetic:Multiply

4. Display each magnitude spectrum after it has been filtered.

   1. Glyphs:Visualization:Non-Interactive Display:Display Image

5. Take the inverse Fourier transform and display the real part of it. Use operators FFT and Real Part. When calculating the inverse DFT, set the option to "Scale output by 1/N per transform "axis".

   1. Glyphs:Arithmetic:Linear Transforms:FFT
   2. Glyphs:Arithmetic:Complex Operators:Real Part

Exercises

1. Perform the same experiment with different parameters (diameters) for the "ideal" filters.
2. Design non-ideal filters (Butterworth, Exponential, Chebyshev I, and Chebyshev II) and repeat the experiment. Experiment with the order of a filter and the parameters.

Khoros Workspace
Execute the visual program c5s7fourier-square-filtering.wk