Focus: Region Representation, Corner Detection
1. [3 points]: Solve by hand: find the Freeman chain code for the figure below. Make sure your solution
is insensitive to 90o
rotation-increments and independent from the starting point.
+2 for a code insensitive
+1 for a code
2. [10 points]: Download the image ‘hands.png’ from Connect, then implement in Matlab an algorithm
based on “Region Representation” (as discussed in the lecture) in order to differentiate between the
three classes of objects in the image, i.e. (i) ‘High-Five’, (ii) ‘Pointing’, and (iii) ‘Circle’ (see the output
image below). Assume the input image will only have these three classes of objects.
+3 for using the right features for classification
+3 for the correctly classifying the blobs
+2 for the output image (similar to the above)
+2 for the overall algorithm
3. [7 points]:
(a) write a Matlab function getcorners with the header:
[r,c] = getcorners(I, method, sigma, thresh, alpha)
where the parameters in italic are optional. Below is a description of the function.
% returns the coordinates (row and column) of corners in a given grayscale image.
% USAGE: [r,c] = getCorners(I, METHOD, sigma, thresh, alpha)
% I: a grayscale image
% METHOD: can be one of ‘h’ or ‘s’
% ‘h’ for Harris cornerness measure
% ‘s’ for Szelski cornerness measure
% SIGAM: used to compute the size of Gaussian filter (size=6*SIGMA) and it is
% also used to compute the size of dilation filter used in nonmaximal suppression
% of the output, default: 1.
% THRESH: for cornerness strength (default: 0.50, i.e. 50% of max R)
% ALPHA: used only for “Harris” method (default: 0.04)
You will need to use an if statement to compute the cornerness value R (i.e. using either
Harris or Szeliski).
The value of thresh is a percentage of the maximum R obtained. Use thresh to remove
weak corners from R.
You may use nargin Matlab function to set default values for the optional parameters in
You can reuse the code from the lecture notes.
(b) test your function with the ‘cameraman.tif’ image. Detect the corners once using Harris measure
and once using Szeliski’s measure. Use the values: sigma=1, thresh=30%, alpha=0.004
(c) Also, write a for loop to change the value of alpha used for Harris and note the output.
+4 for (a)
+1 for (b)
+2 for (c)
1- Solve Q1 by hand and submit as a text file. Name your file Q1.txt (or Q1.docx, etc).
2- Write a separate Matlab program or function for each of questions Q2 and Q3.
3- You are not required to justify or comment on the outputs from any of Q2 or Q3.
4- Submit everything as one zip file to Blackboard Connect. Note that you can resubmit an
assignment, but the new submission overwrites the old submission and receives a new