[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:
-
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.
-
Glyphs:Input/Output:Data Files:
User defined
-
Glyphs:Data Manip:Data Conversion:
Convert Type
-
Glyphs:Visualization:Non-Interactive Display:
Display Image
-
Restore the "Inverse Filter" procedure that you saved from the
previous session using the File:Open menu.
-
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.
-
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.
-
Glyphs:Arithmetic:Two Operand Arithmetic:
Subtract
-
Glyphs:Visualization:Non-Interactive Display:
Display Image
-
The pseudo-inverse filtering is one way to solve the problem normaly
associated with the ideal inverse filter.
Implement a pseudo-inverse filter.
-
Duplicate the "Inverse Filter" procedure
-
Select the "Inverse Filter" procedure and duplicate it.
-
Change the name of the new procedure to "Pseudo-Inverse"
-
Connect the output of
Convert Type to the input of
"Pseudo-Inverse".
-
Open the "Pseudo-Inverse" by clicking on the "Open Procedure"
icon
-
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.
-
Glyphs:Arithmetic:Complex Operators:
Magnitudes
-
Glyphs:Data Manip:Analysis & Information:
Statistics
-
Glyphs:Arithmetic:Comparison Operators:
>
-
Glyphs:Arithmetic:Two Operand Arithmetic:
Multiply
-
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.
-
Print the statistics of the magnitude image and determine the
threshold value to assign to the
> operator.
-
Threshold the magnitude image.
-
Multiply the output of the threshold operation with the ideal
inverse filter (the output of the
Divide Into operator).
-
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.
-
Run this procedure to find the restored image using a
pseudo-inverse filter.
-
Iconify the procedure by selecting the "Close" button in the
upper right hand corner of the procedure workspace.
-
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.
-
Glyphs:Input/Output:Data Files:
User defined
-
Glyphs:Data Manip:Size & Region Operators:
Pad
-
Glyphs:Arithmetic:Linear Transforms:
FFT
-
Glyphs:Data Manip:Frequency Filters:
InvFilter
-
Open the
InvFilter and set the threshold value to the value
you used in the "Pseudo-Inverse" procedure.
-
Glyphs:Arithmetic:Linear Transforms:
FFT
-
Glyphs:Arithmetic:Complex Operators:
Magnitudes
-
Glyphs:Visualization:Non-Interactive Display:
Display Image
Exercises
-
What happens if the threshold value used in the "Inverse Filter"
is zero?
-
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