Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

i have calculated the distance of one image with 30 images,now i want to find the nearer distance with the smallest diatance and wnat to diaplay the images having small distance with the input image i.e the similar images.

1 Ansicht (letzte 30 Tage)
b=dlmread('features38.mat')
%b1=dlmread(fr)
b1=dlmread('frs.mat')
sum=0;
for i=1:8
g = (b(i) - b1(j,i))^2
sum=sum+g
end
dist = sqrt(sum);
E_dist(j)=dist
disp(E_dist);
if(E_dist(j) <.0022)
subplot(3,3,m)
imshow(I);
m=m+1;
end
end
sd=sort(E_dist)

Antworten (1)

Image Analyst
Image Analyst am 21 Jun. 2014
First of all DO NOT USE SUM AS THE NAME OF A VARIABLE BECAUSE IT DESTROYS THE BUILT IN SUM() FUNCTION!
I'm not sure what that for loop does anyway. But if E_dist is a list of your distances, to find the index with the smallest distance, use min()
[minDistance, indexOfMin] = min(E_dist);
Then display the pair of images with imshow().

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by