[Exercises]
[Workspace]
Purpose:
The purpose of this lab exercise is to experiment with the
concepts of linear and circular convolution, and to compare the two
methods.
At the time this lesson was prepared, the linear operator
does not output a larger image as explained. In the implementation,
the output size is the same as the input size image.
In this experiment the image $DIP/data/draw-small.kdf is
used. It is a small 32 x 32 image with floating point pixels with
values 0.0 and 1.0.
Activities:
-
Since the images used in this experiment are small (32x32) and
(64x64), create an image zoomed by a factor of 4, using the
operators Expand and Display Image. Read and display the
image zoomed $DIP/data/draw-small.kdf. Remember that the expanded version
is for display purpose only, not to be processed.
-
Glyphs:Input/Output:Data Files:User defined
-
Glyphs:Data Manip:Size & Region Operators:Expand
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Convolution kernels
-
Build a shifted h(2,2) = 1 kernel: This kernel is a 3x3 image,
where all values are zero, except for the position (2,2), which is:
-
Use the operator Impulse to create the kernel, and verify it
using Print Data and File Viewer.
-
Glyphs:Input/Output:Generate Data:Impulse
-
Glyphs:Input/Output:Information:Print Data
-
Glyphs:Input/Output:Information:File Viewer
-
Build a 3x3 average kernel using the operator Constant. The sum
of all pixels in the kernel should add up to 1. Use Print Data
and File Viewer to verify the kernel.
-
Glyphs:Input/Output:Generate Data:Constant
-
Glyphs:Input/Output:Information:Print Data
-
Glyphs:Input/Output:Information:File Viewer
-
Sobel X kernel
-
Read and print the contents of the ASCII
file $DIP/data/sobel_x.ascii using the User defined and File Viewer
operators.
-
Glyphs:Input/Output:Data Files:User defined
-
Glyphs:Input/Output:Information:File Viewer
-
For all three kernels, perform boths linear and circular
convolutions using the $DIP/data/draw-small.kdf image.
Use LinearOp (Linear Operator) to perform the convolution. Expand all by a factor of 4
with Expand operator and display it with Display Image operator.
-
Glyphs:Arithmetic:Linear Transforms:LinearOp (Linear Operator)
-
Glyphs:Data Manip:Size & Region Operators:Expand
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
The LinearOp (Linear Operator) parameter "Kernel hotspot" determines the kernel
origin. If it is not selected, by defaul the kernel origin it at
position (0,0). In the case of the average and Sobel kernels, the
kernel origin must be set at (1,1). In those cases, set the
"Kernel hotspot" parameter to Width=1 and Height=1.
Exercises
-
Explain how the position of the extracted image is dependent on the
kernel origin.
Khoros Workspace
Execute the visual program c6s1convolution.wk
Main DIP Menu
DIP Feedback Form
Copyright © 1997-1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved