Using non-maximum suppression, I got 113 good matches with 2 bad matches with 98% accuracy.

Project 2: Local Feature Matching


Interest Points Detection


Algorithm
I used the Harris corner detector algorithm to find interest points of an image. For the Harris corner detector, I would first have patches that when shifting them, it would cause a drastic change. At the implementation level, I used derivatives of gaussian filters to get the horizontal and vertical gradients. Then I filtered the images, and calculated second moment matrix and cornerness scores. Below is the algorithm which I followed.

1) Compute x and y derivatives of image
2) Compute products of derivatives of every pixel
3) Compute the sums of products of derivatives at each pixel
4) Define at each pixel (x,y) the matrix
5) Compute the response of the detector at each pixel

These parameters were tweaked to allow for more accuracy:

gauss = fspecial('gaussian', 4*sigma+1, sigma);

corner = gix2 .* giy2 - gixy .* gixy - alpha * (gix2 + giy2) .* (gix2 + giy2);
corner = corner .* (corner > threshold * maxvalue);

Non-maximum suppression was also implemented. This method would ignore some of the less significant points. for suppressing some of the unimportant points.

Using non-maximum suppression, I got 215 good matches and 0 bad matches with 100% accuracy.
Using non-maximum suppression, I got 215 good matches and 0 bad matches with 100% accuracy.












Without using non-maximum suppression, I got 276 good matches and 4 bad matches with 99% accuracy.
Using non-maximum suppression, I got 276 good matches and 0 bad matches with 99% accuracy.













Local Features Description


For finding descriptors, I used the SIFT algorithm by taking the gradients of the image and calculating the magnitude and the orientation at every pixel. SIFT performs really well since it is invariant to scale and orientation.


Feature Matching


For matching features, I simply used Matlab's k nearest neighbor search algorithm with k=2. My code for matching is as follows:


	[index, d] = knnsearch(features1, features2, 'K', 2);
	matches = []; confidences = [];
	for i = 1:size(index, 1)
	    indexes = index(i, :); distances = d(i, :);
	    if distances(1) / distances(2) < 0.76
	        matches = [matches; indexes(1) i]; confidences = [confidences; 1 - distances(1)];
	    end
	end
	


Results


Using non-maximum suppression.
Using non-maximum suppression.












Using non-maximum suppression.
Using non-maximum suppression.













Analysis


My SIFT algorithm worked really well with most of the images as seen already. But when I ran it on the Episcopal Gaudi pair, it failed to even detect interest points. Reason for this I think is the intensity of the images. Since SIFT is not really invariant to intensity of the images, it would fail to produce accurate results.