# How to find euclidean distance?

4 views (last 30 days)
Nisreen Sulayman on 29 Jun 2015
Edited: Nisreen Sulayman on 29 Jun 2015
I have a matrix Features_DB with size 13*30 where each column represent shape features of 13 image.
I want to match between a Query Image shape feature variable Query_Feature with size 13*7(I have 7 query images) and the features vectors for the 30 image represented by

Luuk van Oosten on 29 Jun 2015
Have you tried something like:
Z = dist(shapefeature{i},QI_Shape_feature{i})
You can see here how to use "dist" for euclidean distance weight function.
Nisreen Sulayman on 29 Jun 2015
Edited: Nisreen Sulayman on 29 Jun 2015
Thank you, but it didn't work.
Could you please correct the following code
[C R]=size(Query_Features);
for j=1:R %R=1:7
Q_F=Query_Features(:,j);
E_D(j)=Euclidean_dist(Features_DB,Q_F)
save('Euc_Dist.mat','E_D(j)')
end
function [ E_D ] = Euclidean_dist(Features_DB, Query_Features )
%Features_DB: Matrix where each column represent a feature vector,
%[X,Y]=size(Features_DB): X,number of features; Y, number of images.
%X=13,Y=30
%Query_Feature:Matrix where each column represent a feature vector of a
%query image.
%[X,Y]=size(Query_Features): X,number of features; Y, number of images.
%X=13,Y=7
[X,Y]=size(Features_DB);
for i=1:Y
E_D=dist(Features_DB(:,i),Query_Features(:));
end
end