CS 143 / Project 2 / Local Feature Matching

Example of a right floating element.

The project aims at implementing algorithms to identify features in different images of the same object. The implemented parts include:

  1. Interest point detection
  2. Local feature description
  3. Feature matching

Interest point detection

The Harris corner detector is implemented to find the basic local features.

scale 0.010.0150.0170.01750.018 0.020.030.040.05
wrong match16 15 11 11 11 11 11 13 14
correct match86 83 82 82 82 79 76 74 70
rate0.186 0.181 0.134 0.134 0.134 0.139 0.145 0.17 0.20

Set scale = 0.018. Similarily, set rate of distance to 0.77.

Local feature description

The default feature_width is 16. We need to calculate the gradient of the 16 * 16 matrix surrounding the feature point.

for p = 1:4
    for q = 1:4
 	dy = aY(p,q);
        dx = aX(p,q);
        at = (pi + atan2(dy,dx))*4/pi;
        index = ceil(at);
        count(index) = count(index) + norm([dy dx]);
    end
end

Feature matching

Find the two nearest neighbors to the target feature, and then store the ratio as confidences. The matlab built-in function sort is very efficient in finding the nearest neighbors. The following is how I implemented.

for j = 1 :num_features2
        v = [v sqrt(sum((features1(i, :) - features2(j , :)).^2))];
    end
    [v ind]  = sort(v);
    d1 = v(1);
    d2 = v(2);
    minindex = ind(1);
    if d1 / d2 < 0.77
        matches = [matches ; [i minindex]];
        confidences = [confidences ; d1 / d2];
    end

Results