$25
1. Template Matching
a. Forward transformation:
Write a MATLAB function to perform the transformation for three template points with the parameters as shown in Table 1. Show and plot three points before and after transformation. The transformed points are accurate to three decimal places.
Template
Features
1
2
3
X
0
7
3
Y
0
4
8
Table 1. Parameters
(xd, yd) = (6, 7) θ = 60°
k = 0.8 b. Pseudo inverse method:
Write a MATLAB function to perform the pseudo inverse method on the template and transformation points in part (a) to find parameters k, θ, xd, yd. Check these values with Table 1. c. Polygon matching:
Write a MATLAB program to perform template matching on the template and target as shown in Table 2 and Figure 1 to identify the match points, and determine the transformation parameters; namely scale k, orientation θ, and displacement (xd, yd).
Note 1: Given n points, there are n3 = (n−n3 !3!!) unique triangles. Use Matlab function
nchoosek( ) to compute all possible combinations of vertices to form unique triangles.
Note 2: You may find Matlab function sort() useful to arrange the order of vertex in a triangle by the corresponding length.
Note 3: As there are many triangles to be matched, your program must automate the matching process to avoid tedious manual matching.
Note 4: Determine the ‘best’ match by finding the one that yields the smallest ‘matching error’
k defined by Eq. (11) in [Lee, et al., 1992]. ( E= (xti −xi )2 +(yti −yi )2 )
i=1
2. Feature Points Detection y
a. Use rho-theta signature method discussed in class, implement using MATLAB, to locate all the corners of the object in ‘HW2.png’. Plot the signature for locating the corners. Show the coordinates of the corners with respect to the coordinate system as shown.
b. Repeat (a) with median length method. Pick an appropriate N
(length of the neighbor). Plot median-length as a function of path.
Show the coordinates of the corners with respect to the coordinate
Figure 2. HW2.png
system as shown.
c. Repeat (a) with curvature method, which is to locate the ‘peaks’ of the curvature along the boundary. Plot the graph that you used to locate the corners. Show the coordinates of the corners with respect to the coordinate system as shown.
Figure 3. Camera.png
3. Hough Transform
a. Show that
xo yoT =gx gyT
where =(xgx +ygy )/(gx2 +gy2).
b. With the parameters (xo, yo), write a MATLAB program to perform Hough transform (Foot-of- normal parameterization) on image ‘Camera.png’ to find the yellow edge line:
1) Convert RGB image to gray level image and followed by the binary edge image (edge pixel: 1, others: 0). Suggested Matlab functions: rgb2gray.m, edge.m.
2) Apply the Sobel operation on the binary edge image in (1). Suggested Matlab functions: imfliter.m.
3) Determine the accumulator matrix for (x0, y0).
4) Find (x0, y0) and the equation of the yellow edge of the camera.
c. Use Hough Transform on the points of inner boundary to find the circle in HW2.png.