72 good matches, 5 bad matches, 93.5% good ratio.
Fist of all, special Thanks to one TA of Computer Vision. Sorry that I do not know your name...Thank you so much for offering great help even when you are not on duty. I followed the handout and finished all the requirements. To make the assignment cooler, I tried different methods such as non-maximum suppression and three ways of getting features. For Notre Dame images, I got a result of 72 total good matches, 5 total bad matches. The ratio of "good" here is 93.5%. Considering that the higher "confidence" is (you know what it means, right?), the larger probability an "interesting point" would have to perform a "good match", I gave codes for you to choose any rank of confidences you want. I chose the first 99% higher confidences here.
highlighting
(1)sort, rearrange and choose any rank of "confidences". (2)cluster and get features fast.
%example code
[distance_s, index_s] = sort(distance, 2,'ascend');
matches( : , 1) = 1: num_features1;
matches( : , 2) = index_s(:,1);
%get confidences
ratio = distance_s(:,1)./distance_s(:,2);
confidences = 1-ratio;
%select points with confidences larger than 0.35
pick = confidences >0.35;
%select points with any confidence and rank of confidence you want to set
%here we choose the highest confidences, because the higher the confidence
%is, the higher probability the points have for a good match
[select, kk] = sort(confidences, 'descend');
%you can set the 0.99 here to be any number less than 1
matches = matches(kk(1:ceil(sum(pick)*0.99)),:);
confidences = confidences(kk(1:ceil(sum(pick)*0.99)),:);
cluster1 = ge(gradientxy, bin1).*lt(gradientxy,bin2).*magnitudexy;
cluster2 = ge(gradientxy, bin2).*lt(gradientxy,bin3).*magnitudexy;
cluster3 = ge(gradientxy, bin3).*lt(gradientxy,bin4).*magnitudexy;
cluster4 = ge(gradientxy, bin4).*lt(gradientxy,bin5).*magnitudexy;
cluster5 = ge(gradientxy, bin5).*lt(gradientxy,bin6).*magnitudexy;
cluster6 = ge(gradientxy, bin6).*lt(gradientxy,bin7).*magnitudexy;
cluster7 = ge(gradientxy, bin7).*lt(gradientxy,bin8).*magnitudexy;
cluster8 = ge(gradientxy, bin8).*lt(gradientxy,bin9).*magnitudexy;
%initialize the features
features = zeros(size(x,1), 128);
n = length(x);
%initialize the eight parts corresponding to each part of the features
r1 = zeros(n,16);
r2 = zeros(n,16);
r3 = zeros(n,16);
r4 = zeros(n,16);
r5 = zeros(n,16);
r6 = zeros(n,16);
r7 = zeros(n,16);
r8 = zeros(n,16);
%get the features
vec = [1, (1+feature_width/4) , (1+feature_width/2), (1+feature_width/4*3)];
for ii = 1:n
for i = 1:4
for j = 1:4
r1(ii,4*i+j-4) = sum(sum(cluster1(y(ii)-feature_width/2+vec(j):y(ii)-feature_width/2+vec(j)+(feature_width/4-1), x(ii)-feature_width/2+vec(i):x(ii)-feature_width/2+vec(i)+(feature_width/4-1))));
r2(ii,4*i+j-4) = sum(sum(cluster2(y(ii)-feature_width/2+vec(j):y(ii)-feature_width/2+vec(j)+(feature_width/4-1), x(ii)-feature_width/2+vec(i):x(ii)-feature_width/2+vec(i)+(feature_width/4-1))));
r3(ii,4*i+j-4) = sum(sum(cluster3(y(ii)-feature_width/2+vec(j):y(ii)-feature_width/2+vec(j)+(feature_width/4-1), x(ii)-feature_width/2+vec(i):x(ii)-feature_width/2+vec(i)+(feature_width/4-1))));
r4(ii,4*i+j-4) = sum(sum(cluster4(y(ii)-feature_width/2+vec(j):y(ii)-feature_width/2+vec(j)+(feature_width/4-1), x(ii)-feature_width/2+vec(i):x(ii)-feature_width/2+vec(i)+(feature_width/4-1))));
r5(ii,4*i+j-4) = sum(sum(cluster5(y(ii)-feature_width/2+vec(j):y(ii)-feature_width/2+vec(j)+(feature_width/4-1), x(ii)-feature_width/2+vec(i):x(ii)-feature_width/2+vec(i)+(feature_width/4-1))));
r6(ii,4*i+j-4) = sum(sum(cluster6(y(ii)-feature_width/2+vec(j):y(ii)-feature_width/2+vec(j)+(feature_width/4-1), x(ii)-feature_width/2+vec(i):x(ii)-feature_width/2+vec(i)+(feature_width/4-1))));
r7(ii,4*i+j-4) = sum(sum(cluster7(y(ii)-feature_width/2+vec(j):y(ii)-feature_width/2+vec(j)+(feature_width/4-1), x(ii)-feature_width/2+vec(i):x(ii)-feature_width/2+vec(i)+(feature_width/4-1))));
r8(ii,4*i+j-4) = sum(sum(cluster8(y(ii)-feature_width/2+vec(j):y(ii)-feature_width/2+vec(j)+(feature_width/4-1), x(ii)-feature_width/2+vec(i):x(ii)-feature_width/2+vec(i)+(feature_width/4-1))));
end
end
end
features = [r1 r2 r3 r4 r5 r6 r7 r8];
![]() |
![]() |
Special Thanks to one TA of Computer Vision. Sorry that I do not know your name...Thank you so much for offering great help even when you are not on duty