I first blure the image using:
gauss_window= fspecial('Gaussian', 5, 1);
Bimage = imfilter(image,gauss_window);
The blurred image is used to calculate the image xy gradient using matlab imgradientxy function. Boundary elements of matrix R (corner response matrix) is zeroed out.
non-maximum suppression was done using matlab colfit function.
I used what we discussed in the class. This was an easier step. The guassia filter with follwoing characteristics:
was used.
Please look out the code below for gradient and summation calulation used for local feature detection.
for i = 1:length(x)
Y_part = mod(y(i)-7:y(i)+8,size(Bimage,1)); Y_part(Y_part == 0) = size(Bimage,1);
X_part = mod(x(i)-7:x(i)+8,size(Bimage,2)); X_part(X_part == 0) = size(Bimage,2);
window = image(Y_part,X_part);
gauss_filter = fspecial('Gaussian', 3, 1);
blur_window = imfilter(window,gauss_filter,'symmetric');
[Gmag,Gdir] = imgradient(blur_window);
Gdir(Gdir < 0) = 360 + Gdir(Gdir < 0);
Guass_weighted = fspecial('Gaussian', feature_width, feature_width/2);
Gmag = Guass_weighted.*Gmag;
count = 1;
for k = 1:size(orientations,2)-1
for m = 0:3
for j = 0:3
g_angle = Gdir(m*4+1:m*4+4,j*4+1:j*4+4);
g_mag = Gmag(m*4+1:m*4+4,j*4+1:j*4+4);
idx = g_angle >= orientations(k) & g_angle < orientations(k+1);
features(i,count) = sum(g_mag(idx));
count = count+1;
end
end
end
end
I simplt used pairwise euclidean distance for feature matching. Ration test was also applied first to second nearest neighbor and the results were thresholded on the confidence.
Here is my result line for all three images:
The corresponding images for all three are seen below:
Notre Dame:
Good (green) and bad (red) matches |
Interest point matching |
Interest points |
Rushmore:
Good (green) and bad (red) matches |
Interest point matching |
Interest points |
Gaudi:
Good (green) and bad (red) matches |
Interest point matching |
Interest points |
I used matlab PCA to decrease the number of features to the 32 most variant features. Here is the code for my PCA:
% PCA
features = features./repmat(sum(features,2),1,128);
outPCA = pca(features);
pca_points = features*outPCA;
pca_points = pca_points(:,1:32);
pca_points = pca_points./repmat(sum(pca_points,2),1,32);
features = pca_points;
For some reason PCA totally wrecked my pipeline and I was not able to trace the problem in the time. Hope you still consider my endavour in doing so.