Keywords: front-page

## Lab: Image Enlargement

[Exercises] [Workspace]

Purpose: The purpose of this lab is to experiment with interpolation by using filtering techniques and several types of low pass filters to produce different quality interpolations.

Activities:

1. Display the image $DIP/data/map-roi.kdf and its Fourier Transform.

   1. Glyphs:Input/Output:Data Files:User defined
   2. Glyphs:Visualization:Non-Interactive Display:Display Image
   3. Glyphs:Arithmetic:Linear Transforms:FFT

2. Create the image expanded by 4, without any interpolation. Khoros does not have an operator that does this, so the idea is to expand the image using zero order interpolation and then multiply by a grid image:

   1. Resample the image by 4 using a "pixel replication" interpolation method available in the Resample operator.

      1. Glyphs:Data Manip:Size & Region Operators:Resample

   2. Create a grid image with impulses of value 1 spaced by 4, using the Impulse operator.

      1. Glyphs:Input/Output:Generate Data:Impulse

   3. Multiply the grid image with the expanded image to obtain the desired image, geometrically expanded by 4, with no interpolation. Display the result.

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

3. Calculate the DFT of the expanded image and display the spectrum.

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

4. Implement the spatial domain interpolation of the expanded image using convolution and the following kernels, and display the results. Also, perform the DFT of the results and display those spectra.

   1. Zero order interpolation with average 4x4 filter: use the Constant operator to build a 4x4 kernel with constant value 1.

      1. Glyphs:Input/Output:Generate Data:Constant
      2. Glyphs:Arithmetic:Linear Transforms:LinearOp (Linear Operator)
      3. Glyphs:Arithmetic:Linear Transforms:FFT
      4. Glyphs:Visualization:Non-Interactive Display:Display Image

   2. Bilinear interpolation: To create the kernel, multiply the output of two Piecewise Linear operators, both generating an image of size 9x9, of values ranging from 0 to 1, and with the following parameters

            Period:      9
            Rise Time:   4
            Fall Time:   4
            Pulse Width: 0

      for X in one image and for Y in the other

      Visualize the kernel you created by expanding it and displaying it. Use the Expand and Display Image operators.

      1. Glyphs:Khoros 1:Generate Data:Piecewise Linear
      2. Glyphs:Data Manip:Size & Region Operators:Expand
      3. Glyphs:Visualization:Non-Interactive Display:Display Image
      4. Glyphs:Arithmetic:Two Operand Arithmetic:Multiply
      5. Glyphs:Arithmetic:Linear Transforms:LinearOp (Linear Operator)
      6. Glyphs:Arithmetic:Linear Transforms:FFT

5. Implement frequency domain interpolation using the FFT operator and the following frequency filters, which you can create using the operator Low-Pass. It is necessary to filter the image with a cutoff period of 8.

   1. Create an ideal filter.

      1. Glyphs:Image Proc:Frequency Filter:Low-Pass

   2. Create a Butterworth filter of order 3.

      1. Glyphs:Image Proc:Frequency Filter:Low-Pass

   3. In the frequency domain, multiply the two filter spectra with the spectrum from the expanded image.

      1. Glyphs:Arithmetic:Two Operand Arithmetic:Multiply

   4. Display the resulting spectra.

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

   5. Calculate the inverse Fourier transform and display the results.

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

Exercises

1. What is the cutoff frequency of the filters as function of the scaling factor?
2. What is the result if we expand the DFT of the original image using pixel replication algorithm and take the inverse DFT? Use the expand property of the DFT and the convolution theorem to explain the results.

Khoros Workspace
Execute the visual program c6s6interpolation.wk