[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:
-
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.
-
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:
-
Glyphs:Input/Output:Data Files:User defined
-
Glyphs:Data Manip:Size & Region Operators:Extract
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Set the proper region size for the Extract operator, connect,
and run the network.
-
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:
-
Glyphs:Input/Output:Data Files:User defined (Open the pane and select "Moon (xvimage)").
-
Glyphs:Data Manip:Size & Region Operators:Inset
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Connect the "moon" image to "Input 1" of the Inset operator, and
connect the ruler that you extracted to "Input 2".
-
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.
-
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.
-
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.
-
Build a lower resolution image using the operator Resample.
-
Glyphs:Data Manip:Size & Region Operators:Resample
-
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.
-
Inset the ruler image into lower resolution image and display
the result.
-
Duplicate the Inset and Display Image operators created in part 1-B.
-
Connect the output of Resample to "Input 1" of Inset, and
connect the ruler image you extracted to "Input 2".
-
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).
-
Run the new operators, and compare the results of parts 1 and 2.
Exercises
-
Experiment with the Resample operator to generate images with
different resolutions.
Khoros Workspace
Execute the visual program c2s3resolution-moon.wk
Main DIP Menu
DIP Feedback Form
Copyright © 1997-1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved