how to find Euclidean distance in matlab?

조회 수: 3 (최근 30일)
ganesh s
ganesh s 2011년 12월 2일
편집: Walter Roberson 2017년 10월 11일
hi i have extracted the feature of the 1000 images by using color Correlogram & saved it in a .mat file, now i want to match some query image(consist of .mat file) with this data base by using Euclidean distance for image retrieval.but i don't know how to find the Euclidean distance between 1000 data base images & one query image. thanks
  댓글 수: 1
ganesh s
ganesh s 2011년 12월 2일
want to find Euclidean distance between 1000 images(.mat file)& one query image (.mat file) in MATLAB

댓글을 달려면 로그인하십시오.

채택된 답변

Junaid
Junaid 2011년 12월 2일
Dear what is the size of your feature vector, if it is column vector then let say your have 1000 feature vector of 1000 images. I denote it by D, where each column is feature vector of each image, in short column represent single image. and your Query image is Q is single column vector.
it can be computed as simple as;
Q= repmat(Q,1,size(D,2));
E_distance = sqrt(sum((Q-D).^2));
now E_distance is euclidean matrix distance. where each cell is distance of Query with database image.
  댓글 수: 3
Junaid
Junaid 2011년 12월 2일
I assume for Each image you have 1000 x 1 vector. one possible way way is that you concatenate all images to one matrix. Let say you have 100 images then you get D 1000 x 100. Where each column is feature of single image. and then you query Q is 10000x1. then simply
Q = Q';
once you can do it, then above code will give you Euclidean distance Q with all images. You can plot E_distance to see the result.
ganesh s
ganesh s 2011년 12월 2일
thanks again junaid
i already concatenate the all 1000 images in two one column matrix of size(1000x1)with each row represent the extracted image of size(4096x48)now i want to take one query image of size 4096x48(my original image is of size 384x256 after extracting feature by correlogram method it become 4096x48 ) and want to find it's euclidean distance for image retrieval

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

divya r
divya r 2012년 6월 15일
How did you concatenate data from multiple matfiles into one? I have done it fr only 2 .mat files, but i am stuck in the logic for multiple .mat files. Could you please help me out with the logic?
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 6월 15일
Please start a new Question for this matter.
Htet Yamin Ko Ko
Htet Yamin Ko Ko 2017년 10월 11일
편집: Walter Roberson 2017년 10월 11일
if exist('feat.mat')
load feat.mat
else feat= [];
end
feat = [feat,featVec]; % you should use ; for row vectors and , for column vectors
save feat.mat feat
feat.mat is my existing .mat file and featVec is my current extracted feature vector. I hope it helps you.

댓글을 달려면 로그인하십시오.


Dodo Dodda
Dodo Dodda 2016년 5월 18일
I have a data set of 160 images, and i extracted features of these images and saved them in .mat file, now i want to match between features of another image and all features that i saved in the .mat file. How i can do this using eulidean distance algorithm?

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by