computer vision - Matching features of images using PCA-SIFT -
i want match features in 2 images detect copy-move forgery. used pca-sift code detect image features. but, having trouble in matching pca-sift features. according several papers, similar matching process used pca-sift used in sift. have used following code snippet match features.
%des1 , des2 pca-sift descriptors obtained 2 images % precompute matrix transpose des2t = des2'; matchtable = zeros(1,size(des1,1)); cnt=0; %no. of matches %ration of ditances distratio = 0.5; %normalising features m1=max(max(des1)); m2=max(max(des2)); m=max(m1,m2); des1=des1./m; des2=des2./m; = 1 : size(des1,1) %finding eucledian distance of vector in 1 image features in second image a=des1(i,:); d = des2-repmat(a,size(des2,1),1); [vals,indx] = sort((sum(d.^2,2)).^(1/2)); %sort distances % check if nearest neighbor has angle less distratio times 2nd. if (vals(1) < distratio * vals(2)) matchtable(i) = indx(1); cnt=cnt+1; else matchtable(i) = 0; end end cnt
the above code works fine sift features. not able correct results pca-sift features after trying several values of distratio(0-1)
. i'm not sure if matlab central code pca-sift(mentioned above) exact process mentioned in this paper if has idea above problem please comment.
the problem is, pca not preserve euclidean distance between 2 vectors. take simple example data along line y = x. distance between 2 points along line depend on both co-ordinates, if data 1 dimensional, i.e. lying along line. when apply pca, new euclidean distance take principle component account, line y=x, distance between (1,1), (2,2) 1 instead of sqrt(2).
however, if normalize features euclidean norm, nearest neighbor using euclidean distance equivalent computing cosine-similarity (dot-product) between features.
https://en.wikipedia.org/wiki/cosine_similarity
therefore first recommend test if matching sift features works if normalize them l2 norm. if yes, apply pca on features, again normalize pca features l2 norm , compute euclidean distance. far remember, l2 norm of sift vector 1. so, need normalize pca-sift features l2 norm , compute euclidean distance.
Comments
Post a Comment