how do i compare my test image with the one in my database using euclidean distance?

조회 수: 1 (최근 30일)
how do i compare my test image with the one in my database using euclidean distance?

답변 (2개)

Akihumi
Akihumi 2020년 5월 8일
편집: Akihumi 2020년 5월 8일
I assume that you have RGB images.
Do you mean that you want to compute the euclidean distance of the pixes at same location on different images?
If yes, you may try the following
a = imread['image1']; % first image
b = imread['image2']; % second image
c = double(a-b); % difference of each pixel
d = sqrt(c(:,:,1)^2 + c(:,:,2)^2 + c(:,:,3)^2); % compute with formula of euclidean distance
  댓글 수: 3
Akihumi
Akihumi 2020년 5월 9일
It is ok to ask here also, so others can also check my answer and suggest/comment on it
Afiqah Zafrullah
Afiqah Zafrullah 2020년 5월 9일
i was asked to find the average of all array values n compare it with the average of the average value of the reference array then assign the character to the minimum value. i dont know how this work since im new to matlab and have no one else to refer

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


Image Analyst
Image Analyst 2020년 5월 9일
Try this:
theMean = mean(allArrayValues) % Take the mean of all elements in variable allArrayValues
refMean = mean(yourReferenceArray(:)) % Get mean of reference values.
minValue = min([theMean, refMean]); % Get the minimum of the values.
% No idea what "assign the character to the minimum value" means, but maybe this:
theCharacterValue = minValue; % assign the character to the minimum value

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by