[Exercises]
[Workspace]
Purpose:
The purpose of this lab exercise is to experiment with
template matching, correlation, and normalized correlation using
spatial convolution.
Activities:
-
Read and display the image $DIP/data/gull.kdf. Convert it to
floating point using the operator Convert Type.
-
Glyphs:Input/Output:Data Files:User defined
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Glyphs:Data Manip:Data Conversion:Convert Type
-
Extract a small (10x10) pattern from the image using the Extract
operator. Determine the coordinates of the region you wish to
extract by moving the cursor over the pattern in the displayed image.
Display the extracted region (first expand it by a factor of 10).
-
Glyphs:Data Manip:Size & Region Operators:Extract
-
Glyphs:Data Manip:Size & Region Operators:Expand
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Perform the correlation between the image and the pattern using
the LinearOp (Linear Operator) operator. Set its parameter option to perform the
"Correlation". Display the result with the Display Image glyph.
-
Glyphs:Arithmetic:Linear Transforms:LinearOp (Linear Operator)
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Use the Statistics operator to find the coordinates of the
maximum point of the resulting image. Open the Statistics pane and
select the "maximum", and the width and height coordinates of the
maximum.
-
Glyphs:Data Manip:Analysis & Information:Statistics
Notice that the maximum does not occur where you would expect
it to, which is over the pattern that you extracted.
-
Perform the normalized correlation.
-
Multiply converted $DIP/data/gull.kdf image for it.
-
Glyphs:Arithmetic:Two Operand Arithmetic:Multiply
-
Create a constant kernel of value 1 that is the same size as the
pattern (10x10) using the Constant operator. Perform correlation
between the multiplyed image and this kernel. Set up the
LinearOp (Linear Operator) operator as you did in step 3.
-
Glyphs:Input/Output:Generate Data:Constant
-
Glyphs:Arithmetic:Linear Transforms:LinearOp (Linear Operator)
-
Take the square root of the result of the correlation in step B,
using the Square Root operator.
-
Glyphs:Arithmetic:Single Operand Arithmetic:Square Root
-
Divide the original correlation image (step 3) by the normalization
factor image just created, and display the result.
-
Glyphs:Arithmetic:Two Operand Arithmetic:Divide
-
Glyphs:Visualization:Non-Interactive Display:Display Image
-
Find the maximum of the normalized correlation using the Statistics
operator as you did in step 4.
-
Glyphs:Data Manip:Analysis & Information:Statistics
Exercises
-
Perform the same experiment, but in the frequency domain.
Khoros Workspace
Execute the visual program c6s5correlation.wk
Main DIP Menu
DIP Feedback Form
Copyright © 1997-1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved