Why am I getting same Euclidean Distance for different images ?
1 次查看(过去 30 天)
显示 更早的评论
I am trying to write a code that will indicate which two images are similar out of three.
% OBJECT: Comparing sift features by euclidean distance
%%Reading Images
img1=imread('106aa.jpg');
img2=imread('107aa.jpg');
img3=imread('107bb.jpg');
%%Resizing Images
resize1=imresize(img1, 0.25) ;
resize2=imresize(img2, 0.25) ;
resize3=imresize(img3, 0.25);
%%Converting rgb images to gray scale images
gray1=rgb2gray(resize1);
gray2=rgb2gray(resize2);
gray3=rgb2gray(resize3);
%%Converting to single precision
% because sift only work on single precision
Ia=single(gray1);
Ib=single(gray2);
Ic=single(gray3);
%%Extracting sift features
[fa, da] = vl_sift(Ia) ;
[fb, db] = vl_sift(Ib) ;
[fc, dc] = vl_sift(Ic) ;
[matches1, scores1] = vl_ubcmatch(da, db) ;
[matches2, scores2] = vl_ubcmatch(db, dc) ;
%%Comparing features vectors by Euclidean distance
fv1= [ 'fa' 'da' ] ;
fv2= [ 'fb' 'db' ] ;
fv3= [ 'fc' 'dc' ] ;
diff1 = fv1 - fv2;
distance1 = sqrt(diff1 * diff1')
diff2= fv2 - fv3 ;
distance2 = sqrt(diff2 * diff2')
0 个评论
采纳的回答
Walter Roberson
2014-1-6
You can not reference variables by strings like that. If that is what you are trying to do. Perhaps you want [fa da]
10 个评论
Walter Roberson
2014-1-9
No it is not possible to subtract vectors of different size. You should be designing your feature vectors so that they are all the same length, and within the feature vectors each sub-group of values should have the same relative offset. You can pad subgroups within feature vectors.
For example, if DCT coefficients start at index 3143 in the first feature vector and extend for 128 values, then the second feature vector should store its DCT coefficients at index 3143 for length 128 as well.
更多回答(1 个)
Image Analyst
2014-1-6
See section 21.4.2.7 here: http://iris.usc.edu/Vision-Notes/bibliography/contentspeople.html#Face%20Recognition,%20Detection,%20Tracking,%20Gesture%20Recognition,%20Fingerprints,%20Biometrics
21.4.2.7 American Sign Language, ASL Recognition
21.4.2.7.1 Sign Language, Other Languages, Chinese, Arabic
21.4.2.7.2 Sign Language, Fingerspelling
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Feature Detection and Extraction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!