i have calculated the euclidean distance of one image with 30 images stored in a databse.Now how i display the images having the smallest distance?If i want to display 4 or 5 images

1 回表示 (過去 30 日間)
I = imread('11.jpg'); I = rgb2gray(I); m=1; srcFiles = dir('fruits\*.jpg'); % the folder in which ur images exists for j = 1 : 30
filename = strcat('fruits\',srcFiles(j).name);
filenam = strcat('fruits',srcFiles(j).name);
I = imread(filename);
%I=graythresh(I);
%I=imresize(I,[20,15]);
fr=strcat('features',filenam,'.mat');
b=dlmread('features11.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) <.0061)
subplot(3,3,m)
imshow(I);
m=m+1;
end
end
sd=sort(E_dist)

採用された回答

Image Analyst
Image Analyst 2014 年 6 月 17 日
You could display them one at a time with imshow(), either in 4 or 5 axes or one at a time in the same axes. Or you could use the montage() function to stitch together all the images into one big image which you can display with imshow().
  2 件のコメント
Anamika baruah
Anamika baruah 2014 年 6 月 17 日
i have to identify the small distances with the input image and display the images with the distances closer to the distance of input image.how i proceed?
Image Analyst
Image Analyst 2014 年 6 月 17 日
You said "i have calculated the euclidean distance of one image with 30 images" so you just take those distances and put it into the min() function
[minDistance, indexOfMin] = min(distances);

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by