Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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 vue (au cours des 30 derniers jours)
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)

Réponses (1)

Image Analyst
Image Analyst le 21 Juin 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().

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by