CS 143 / Project 2 / Local Feature Matching

Original Image

Harris Corner Detector

For this part I first ran a sobel edge detector to get vertical and horizontal edges. I then took the outer product of these two results in order to get the three matrices necessary for corner detection. Before running corner detection, I further blurred these matrices using a 5 by 5 gaussian filter. I then ran the detector to obtain my hcr matrix. I thresholded this at .1 (which seemed correct after some experimentation), and implemented non maximal suppression. I did this by looking in feature_width/2 width windows and only keeping the maximum value in each one. Below are the hcr matrix before non maximal suppression and thresholding, and then the resulting points.

Forming Features

In this part, again, I began by getting the horizontal and vertical edges using a soble filter. I then calculated the magnitudes and directions of the gradient at each pixle (see code). Then I sorted all of the directions into 1 of 8 possibilities, for ease in sorting later. Then at each point in a feature_width by feature_width window, I sorted the magnitudes and directions into the appropriate buckets and formed the size 128 feature in this way. I found that using a falloff function dulled the magnitudes too much, so I commented that part out.

Feature Matching

For this part I calculated the euclidean distance between each pair of features, and stored the nearest, using the ratio of this distance to the distance of the second nearest as a confidence metric. Following are the results. For some reason I am getting very low accuracy, and most of the displayed features are concentrated in the upper right hand corner.