Keywords: front-page

## Lab: Wiener Filtering

[Exercises] [Workspace]

Purpose: The purpose of this lab exercise is to implement a wiener filter by directly implementing the wiener filter equation using Khoros operators, and then implementing it using the Wiener operator provided in Khoros.

The steps in this lesson are similar to those that you followed in Lab 2, the "Pseudo-Inverse Filtering" lesson.

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 Lab 1, the "Inverse Filter" session.

   1. Change the name of the procedure to "Wiener Filter"
   2. Connect the output of Convert Type to the input of the "Wiener Filter" procedure.

3. Implement the Wiener filter, R(u), within the "Wiener Filter" procedure.

   Replace the Divide Into operator with an implementation the Wiener filter equation: R(u) = [H(u)* / (|H(U)|**2 + K)]. Use the following operators: Magnitudes, Add, Divide, and Conjugate. Set the value of K to 0.005.

   1. Open the "Wiener Filter" by clicking on the "Open Procedure" icon.
   2. Glyphs:Arithmetic:Complex Operators:Magnitudes
   3. Glyphs:Arithmetic:Two Operand Arithmetic:Add
   4. Glyphs:Arithmetic:Two Operand Arithmetic:Divide
   5. Glyphs:Arithmetic:Complex Operators:Conjugate
   6. Run this procedure to find the restored image using a wiener filter.
   7. Iconify the procedure by selecting the "Close" button in the upper right hand corner of the procedure workspace.

4. Use operator Wiener to implement wiener 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 Wiener operator. Calculate the magnitude of the inverse DFT of the Wiener 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:Wiener
   5. Open the Wiener and set the "Wiener parameter" to the value you used in the "Wiener Filter" procedure.
   6. Glyphs:Arithmetic:Linear Transforms:FFT
   7. Glyphs:Arithmetic:Complex Operators:Magnitudes
   8. Glyphs:Visualization:Non-Interactive Display:Display Image

Exercises

1. Modify the Wiener parameter in the Wiener operator, visualize its effects and comment on the results.

Khoros Workspace
Execute the visual program c7s3wiener.wk