Project 2: Local Feature Matching

Example of a right floating element.

I implemented part 1 of the project using the slides from class and 4.1.1 of the textbook (Szeliski). It suggested "The classic “Harris” detector (Harris and Stephens 1988) uses a [-2 -1 0 1 2] filter" (p.212 Szeliski), so I took that to be my horizontal gradient and [00 2 00; 00 -1 00; 0; 00 1 00; 00 2 00] to be my vertical gradient. I made three copies of my image, one of which was filtered by the horizontal gradient twice to form I_xx, one of which was filtered by each gradient once to form I_xy, and the last one filtered by the vertical gradient twice to form I_yy. Then, I initialized the coordinates of the interest points x and y. Then, I took a double for loop and for each pixel in the image, I calculated a 2x2 second moment matrix M = [I_xx I_xy; I_xy I_yy] just as I read in the slides and calculated its determinant and trace. Following the slides, R = det(M) - 0.06(tr(M)^2) tells us whether the eigenvalues are positive or negative, as well as large or small. If R > 0.2, then the eigenvalues are positive and large, and we have a corner. Append the point's coordinates to our output x and y using the vertcat function, which I learned about here: https://www.mathworks.com/help/matlab/ref/vertcat.html.