For project 2, I worked to implement Harris Corner Detection, Sift Feature Matching, and the Nearest Neighbor Distance Ratio test to match collected features. The basic algorithm ran in the following fashion.
However, despite my attempted implementation, my feature detection project did not return a substantial accuracy to merit full credit. While using cheat_interest_points, my accuracy was as high a 27 percent, but then dropped to around 2% when get_interest_points was added. This leads me to believe that a substantial bug was present in either my get_features function or get_interest_points function.
%example code
while j <= feature_width && k <= feature_width
cell_Matrix = feature_Matrix(j:j + (cell_width - 1), ...
k:k + (cell_width - 1));
%Gmag, Gdir are both matrices
[Gmag, Gdir] = imgradient(cell_Matrix);
hValue = zeros(1, 8);
for n = 1:cell_width
for m = 1:cell_width
curDirection = Gdir(n, m);
curMagnitude = Gmag(n, m);
if (-180 < curDirection <= -135)
hValue(1) = hValue(1) + curMagnitude;
elseif (-135 < curDirection && curDirection <= -90)
hValue(2) = hValue(2) + curMagnitude;
elseif (-90 < curDirection && curDirection <= -45)
hValue(3) = hValue(3) + curMagnitude;
elseif (-45 < curDirection && curDirection <= 0)
hValue(4) = hValue(4) + curMagnitude;
elseif (0 < curDirection && curDirection <= 45)
hValue(5) = hValue(5) + curMagnitude;
elseif (45 < curDirection && curDirection <= 90)
hValue(6) = hValue(6) + curMagnitude;
elseif (90 < curDirection && curDirection <= 135)
hValue(7) = hValue(7) + curMagnitude;
elseif (135 < curDirection && curDirection <= 180)
hValue(8) = hValue(8) + curMagnitude;
end
end
end
hValue = hValue ./ feature_width;
histogram_Matrix = [histogram_Matrix, hValue];
%histSz = size(histogram_Matrix)
if (j == feature_width + 4)
k = k + 4;
j = 1;
else
j = j + 4;
end
end
Above are the pictures from the Notre Dame test case. The top row is using cheat_interest_points and the bottom is using get_interest_points.