Keywords: front-page

## Lab: DFT: Filtering of Coherent Noise

[Exercises] [Workspace]

Purpose: The purpose of this lab is to experiment with designing custom frequency domain filters, or masks, for filtering coherent noise.

Activities:

1. Read image $DIP/data/barcode.kdf and display it. Use operators User defined and Display Image.

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

2. Take the forward Fourier transform (scale by 1) and display it. Use operators FFT, and Edit Image.

   1. Glyphs:Arithmetic:Linear Transforms:FFT
   2. Glyphs:Visualization:Interactive Display:Edit Image

3. Create the frequency filter image.

   1. Move the mouse cursor over the magnitude spectrum of the image to determine the coordinates of the "stars" (coherent noise).

      1. Applying a colormap may help visualize the points this can be found under the "Options:Colormaps" button in Edit Image. The "Disjoint" and "HSV Rings" colormaps are good choices.
      2. You can to use the "Print Pixels" option in Edit Image to verify the positions of the maximum pixels.
      3. Use the Display Zoom Image option to determine the diameter needed for the masks.
      4. For your convenience, coordinates of the "stars" are given at the end of the lab.

   2. Using the operators Constant, Circle Image, and Inset, create a frequency mask that is the same size as the original image. Note: the mask should have value "zero" to cancel the "stars", and the rest of the pixel values should be set to 1. Why? Select and appropriate diameter for the "zero-out" pattern. When creating the circle image, use the Expand and Display Image operators to verify it.

      1. Glyphs:Khoros 1:Generate Data:Circle Image
      2. Glyphs:Data Manip:Size & Region Operators:Expand
      3. Glyphs:Visualization:Non-Interactive Display:Display Image
      4. Glyphs:Input/Output:Generate Data:Constant
      5. Glyphs:Data Manip:Size & Region Operators:Inset
      6. When using the Inset operators to inset the circles into the background, set the offset parameters so that the center of the circle corresponds to the center of the star.
      7. Display the resulting mask image using the Display Image Operator

   3. Multiply your mask with the DFT of the original image using the Multiply operator. Use the Autocolor operator with "HSV Rings" selected to enhance the result of the multiplication before displaying it with the Display Image operator.

      1. Glyphs:Arithmetic:Two Operand Arithmetic:Multiply
      2. Glyphs:Visualization:Map Display & Manip:Autocolor
      3. Glyphs:Visualization:Non-Interactive Display:Display Image

   4. Take the inverse Fourier transform (scale by 1/N), determine the magnitude spectrum [sqrt(real**2 + imaginary**2)], and display the result. Use operators FFT, Magnitudes, and Display Image.

      1. Glyphs:Arithmetic:Linear Transforms:FFT
      2. Glyphs:Arithmetic:Complex Operators:Magnitudes
      3. Glyphs:Visualization:Non-Interactive Display:Display Image

   5. Determine the absolute difference of the two images and display the result using operators Absolute Diff and Display Image.

      1. Glyphs:Arithmetic:Two Operand Arithmetic:Absolute Diff
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

         "Star" Coordinates: To help save time in Step 3, the center coordinates of the bigger stars are given below.

                  Quadrant 1:
                    ( 11,  10),(  8, 101) ( 27,  84) ( 48,  68) ( 88,  34),(108,  17)
                  Quadrant 2:
                    (168,  94),(188,  77) (208,  60) (228,  44) (248,  27),(244, 118)
                  Quadrant 3:
                    ( 12, 138),(  8, 229),( 28, 212),( 48, 196),( 68, 179),( 88, 162)
                  Quadrant 4:
                    (148, 239),(168, 222),(208, 188),(228, 172),(248, 155),(244, 246)

Exercises

1. Perform the same experiment with different diameters of the "zero-out" patterns.

Khoros Workspace
Execute the visual program c5s8barcode-filter.wk