Project 2: Local Feature Matching

Example of feature matching

For this project I first implemented match features with cheat_interest_points. A challenge going in was I was not sure how exactly the features were formated. I first went over the code to better understand how everything was formatted, the size of the matrices etc. In match features I first tried to figure out a way to get all the euclidean distances between feature1 and feature2. I found a really useful function called pdist2 that was able to give me the euclidean distances in an array. I then got the inverse of the confidence and made sure to inverse it again to get the correct confidance. I initally set the thresholding at 0.5 and slowly raised it to see better results. I used the fuind and index functions to find the corrected indexes and used that to match the features.


	%Putting index of matches into the matches matrix
	filteredFeature = find(inversion < thresholding);
	otherFeature = index(inversion < thresholding, 1);

	matches = [filteredFeature, otherFeature];

	% Sort the matches so that the most confident onces are at the top of the
	% list. You should probably not delete this, so that the evaluation
	% functions can be run on the top matches easily.
	[confidences, index] = sort(confidences, 'descend');
	matches = matches(index,:);

Next after the match_features I faced the problem of not being able to test if I wrote it correctly. This lead to me debugging it only after I finished the get_features function. For the get_features function I first used multiple filters first to accomplish this task. After reading up on SIFT in the textbook, I used a mixture of guassian and sobel filters to get the derivatives of the x and y. I do this to get the smooth directional filter. After the center, I create a 4x4 blocks around the area, by adding and subtracting 8 and 7(because the center is 1 off). I then create the patches from the 4x4 and I do this 8 times to create the 4x4x8 dimensions matrix. I then normalize the matrix while using some thresholding.


	%Getting the patches and concatenating them together
	patchB = valueCalc1(4 * a + 1 : 4 * (1 + a), 4 * b + 1 : 4 * (1 + b));
	patchA = valueCalc2(4 * a + 1 : 4 * (1 + a), 4 * b + 1 : 4 * (1 + b));
	begin = (4 * a + b) * 8;


	for c = 1:8
	    featureP = sum(patchB(c == patchA));
	    matrixF(1, c + begin) = featureP

After I finished the get_features and match_features I was able to debug my code with cheat_interest_points. Something I struggled with was that inaccurately inversed the confidence in the beginning and that affected my accuracy. It was also quite hard finding a good threshold value that was able to maximize the accuracy. After playing aroundwith the different threshold values, I finally reached one I was happy with. After I made sure get_features and match_features were working with the chest_interest_pints I then moved on to the get_interest point function. For this function I first took in the image into a matrix. Then for each layer in the rgb I ran the symmetric gaussian filter. I then got the x, y and xy values from the element wise filtering. Using the alogrithm described in Szeliski, to put hte possible x,y coordinates of the interest points into case.


	%Running the filter on each layer of the RGB
	for i = 1:rgb
	    filteredV(:,:,i) = imfilter(image(:,:,i), dy);
	    filteredH(:,:,i) = imfilter(image(:,:,i), dx);

Overall in terms of performance my accuracy is very high for both the Notre Dame and the Mount Rushmore pictures. With small adjustments in thresholding and sigmas values I was able to get it above 90%. My code however seemed to do terribly on the Episcopal Gaudi percent.

Results in a table