Info

此问题已关闭。 请重新打开它进行编辑或回答。

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 次查看(过去 30 天)
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)

回答(1 个)

Image Analyst
Image Analyst 2014-6-21
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().

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by