Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

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 view (last 30 days)
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)

Answers (1)

Image Analyst
Image Analyst on 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().

This question is closed.

Community Treasure Hunt

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

Start Hunting!