Feature Matching
This involves three major steps:
I used the Harris Corner Detection algorithm for finding interest points. It involves the following steps:
filter = fspecial('Gaussian',3,0.5);
[Gx,Gy] = imgradientxy(filter,'sobel');
Ix = imfilter(image,Gx,'symmetric','same','conv');
Iy = imfilter(image,Gy,'symmetric','same','conv');
Ix2 = Ix.*Ix;
Iy2 = Iy.*Iy;
Ixy = Ix.*Iy;
filter = fspecial('Gaussian',3,1);
GIx2 = imfilter(Ix2,filter,'symmetric','same','conv');
GIy2 = imfilter(Iy2,filter,'symmetric','same','conv');
GIxy = imfilter(Ixy,filter,'symmetric','same','conv');
alpha = 0.05;
Har = (GIx2.*GIy2 - GIxy.*GIxy) - alpha*((GIx2 + GIy2).*(GIx2 + GIy2));
threshold = 1.54e-3;
Har_th = Har>threshold;
Har_th1 = Har.*Har_th;
Har_supp = imregionalmax(Har_th1);
Har_supp1 = Har.*Har_supp;
Har_th_supp = (Har_th1==Har_supp1).*Har_supp1;
[y,x,confidence] = find(Har_th_supp>0);
Norte Dame Interest Points
I used the SIFT feature detection algorithm for finding local features around the interest points. It involves the following steps:
filter = fspecial('gaussian',3,0.5);
image_filtered = imfilter (image, filter,'symmetric','same','conv');
[~ , imgrad_orient] = imgradient(image_filtered, 'sobel');
impatch_or(:,:,i) = imgrad_orient((y(i)-7):(y(i)+8),(x(i)-7):(x(i)+8));
hist_temp = blockproc(impatch_or(:,:,i),[feature_width/4 feature_width/4], fun);
features(i,:) = reshape(hist_temp',[1 ((feature_width/4)^2)*8]);
features(i,:) = features(i,:)/norm(features(i,:),2);
Norte Dame Features
I used the Nearest Neighbour Distance ratios to find the matches. It involves the following steps:
d = pdist2(features1,features2);
[dist,index] = sort(d,2,'ascend');
nn(:) = dist(:,1)./dist(:,2);
threshold = 0.9991;
nn1 = nn < threshold;
nn1index = find(nn1);
matches = [nnindex(nn1index,1),nnindex(nn1index,2)];
confidences = nn(nn1index);
Norte Dame Matches
Image = Mount Rushmore
alpha = 0.05
threshold = 1.54e-3
Accuracy = 97%
Mount Rushmore Matches
Image = Episcopal Gaudi
alpha = 0.04
threshold = 1.54e-3
Accuracy = 5%
Episcopal Gaudi Matches
I used scales 1, 0.5, 0.25 and 0.125. It involves the following steps:
scale_val=0.5.^[0;3];
image1 = imresize(image,scale_val(i));
[x1,y1] = get_interest_points(image1,feature_width,scale_val(i));
scale1=scale_val(i)*ones(size(y1,1),1);
if(i==1)
x=x1;
y=y1;
scale=scale1;
else
x=[x;x1];
y=[y;y1];
scale=[scale;scale1];
end
I used scales 1, 0.5, 0.25 and 0.125. It involves the following steps:
scale_val=0.5.^[0;3];
image1 = imresize(image,scale_val(i));
[index1,~]=find(scale==scale_val(i));
x1=x(index1);
y1=y(index1);
features1=get_features(image1,x1,y1,feature_width);
if(i==1)
features=features1;
else
features=[features;features1];
end
Image = Mount Rushmore
alpha = 0.05
threshold = 1.54e-3
Accuracy = 97%
Mount Rushmore Matches