Lab: Pseudo-Inverse Filtering

[Exercises] [Workspace]

Purpose: The purpose of this lab exercise is to implement a pseudo inverse filter by applying a threshold an ideal inverse filter, and to implement it using the InvFilter operator provided in Khoros.

Activities:

  1. Read the float type blurred image $DIP/data/lenina-blur-float.kdf and convert it to unsigned byte using the Convert Type operator. Display the result using Display Image.

    1. Glyphs:Input/Output:Data Files: User defined

    2. Glyphs:Data Manip:Data Conversion: Convert Type

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

  2. Restore the "Inverse Filter" procedure that you saved from the previous session using the File:Open menu.
  3. Connect the output of Convert Type to the input of the "Inverse Filter" procedure, and run the procedure. These are the results of the ideal inverse filter.
  4. Can you explain the result of the ideal inverse filtering? To help in the explanation, subtract the unsigned byte type image from the float image and display it.

    1. Glyphs:Arithmetic:Two Operand Arithmetic: Subtract

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

  5. The pseudo-inverse filtering is one way to solve the problem normaly associated with the ideal inverse filter. Implement a pseudo-inverse filter.

    1. Duplicate the "Inverse Filter" procedure

      1. Select the "Inverse Filter" procedure and duplicate it.
      2. Change the name of the new procedure to "Pseudo-Inverse"
      3. Connect the output of Convert Type to the input of "Pseudo-Inverse".
      4. Open the "Pseudo-Inverse" by clicking on the "Open Procedure" icon

    2. Implement the pseudo-inverse filter within this new procedure by first calculating the magnitude of the DFT of the kernel filter, and then perform a threshold on it using the greater than > operator. To determine an appropriate threshold value, use the Statistics operator. Multiply the output of the thresholding with the ideal inverse filter to get the pseudo-inverse filter.

      1. Glyphs:Arithmetic:Complex Operators: Magnitudes

      2. Glyphs:Data Manip:Analysis & Information: Statistics

      3. Glyphs:Arithmetic:Comparison Operators: >

      4. Glyphs:Arithmetic:Two Operand Arithmetic: Multiply

      5. Connect the output of the FFT operator to the input of the Magnitudes operator and set the options so that the magnitude of the spectrum is calculated.
      6. Print the statistics of the magnitude image and determine the threshold value to assign to the > operator.
      7. Threshold the magnitude image.
      8. Multiply the output of the threshold operation with the ideal inverse filter (the output of the Divide Into operator).
      9. Connect the output of this multiplication to the input of the Multiply operator (that is multiplying the spectrum of the input image with the filter). Also connect this output to the Display Image operator that originally displayed the ideal inverse filter.
      10. Run this procedure to find the restored image using a pseudo-inverse filter.
      11. Iconify the procedure by selecting the "Close" button in the upper right hand corner of the procedure workspace.

  6. Use operator InvFilter to directly implement pseudo-inverse filtering, and display the results. Calculate the DFT of the unsigned byte image, and pad and calculate the DFT of the Gaussian kernel ($DIP/data/gauss-kernel-21x1.ascii). Use these spectra as input to the InvFilter operator. Calculate the magnitude of the inverse DFT of the InvFilter output and display it.

    1. Glyphs:Input/Output:Data Files: User defined

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

    3. Glyphs:Arithmetic:Linear Transforms: FFT

    4. Glyphs:Data Manip:Frequency Filters: InvFilter

    5. Open the InvFilter and set the threshold value to the value you used in the "Pseudo-Inverse" procedure.
    6. Glyphs:Arithmetic:Linear Transforms: FFT

    7. Glyphs:Arithmetic:Complex Operators: Magnitudes

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


Exercises

  1. What happens if the threshold value used in the "Inverse Filter" is zero?
  2. Modify the filter threshold value in "Inverse Filter".


Khoros Workspace
Execute the visual program c7s2pseudo-inverse.wk



Main DIP Menu
DIP Feedback Form
Copyright © 1997-1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved