Keywords: front-page

## Lab: Spatial Resolution / Image Composing

[Exercises] [Workspace]

Purpose: The physical size that an image pixel represents in the real world is called pixel resolution. This lab demonstrates how image processing techniques, such as sub-sampling, can change pixel resolution.

Activities:

1. Build a ruler and inset it into an image. The input files to use are $DIP/data/ruler.kdf and $DIP/data/moon.kdf. The image "ruler.kdf" has dimension: 512 pixels in width and 14 pixels in height.

   1. Build and display a ruler of width 100 by applying the operator Extract on the image $DIP/data/ruler.kdf. As the extraction is done only in the width dimension, you do not need to select the other dimensions. Select the following operators from the cantata menus:

      1. Glyphs:Input/Output:Data Files:User defined
      2. Glyphs:Data Manip:Size & Region Operators:Extract
      3. Glyphs:Visualization:Non-Interactive Display:Display Image
      4. Set the proper region size for the Extract operator, connect, and run the network.

   2. Inset the 100-width ruler image into the "moon" image at the desired coordinates using the Inset operator. Select the following operators from the cantata menus:

      1. Glyphs:Input/Output:Data Files:User defined (Open the pane and select "Moon (xvimage)").
      2. Glyphs:Data Manip:Size & Region Operators:Inset
      3. Glyphs:Visualization:Non-Interactive Display:Display Image
      4. Connect the "moon" image to "Input 1" of the Inset operator, and connect the ruler that you extracted to "Input 2".
      5. Open the Inset pane and specify the coordinates where you want to inset the upper left corner of the ruler into the moon image. The moon image is 512x512.
      6. Connect the output of Inset to Display Image and run the network. If you move the mouse cursor around in the displayed image, you can place the cursor over points in the image and read the coordinates in the position window that is located below the image.

2. Process the moon image so that it is half its original resolution by sub-sampling. Then inset the same ruler into this image to demonstrate the change in pixel resolution.

   1. Build a lower resolution image using the operator Resample.

      1. Glyphs:Data Manip:Size & Region Operators:Resample
      2. Open the Resample pane and set the "Width" and "Height" magnification factors to 0.5. This will cause the image to be reduced to half its size in both the width and height dimen- sions.

   2. Inset the ruler image into lower resolution image and display the result.

      1. Duplicate the Inset and Display Image operators created in part 1-B.
      2. Connect the output of Resample to "Input 1" of Inset, and connect the ruler image you extracted to "Input 2".
      3. Set the Inset parameters so that the ruler is placed in the appropriate position in the smaller moon image (divide the coordinates you specified in part 1-B step v, by 2).
      4. Run the new operators, and compare the results of parts 1 and 2.

Exercises

1. Experiment with the Resample operator to generate images with different resolutions.

Khoros Workspace
Execute the visual program c2s3resolution-moon.wk