-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.m
45 lines (37 loc) · 1.06 KB
/
search.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
tic
fo=fopen('output.txt','w');
fi=fopen('input.txt','r');
f_cld = fopen('clds.txt','r');
input = textread('clds.txt','%f');
index =vec2mat(input,length(input)/2000);
path='UKentuckyDatabase\UKentuckyDatabase\'; % ruta, si es la actual poner path=pwd
ext='.jpg'; % extension, si no se desea filtrar por extension poner ext=''
ar=ls(path);
for j=1:20
im =fgets(fi);
image = imread(strcat('UKentuckyDatabase\UKentuckyDatabase\',im));
refCld = cld(image);
comparisons = zeros(2000, 2);
compa = strings(size(ar,1),1);
for i=3:size(ar,1)
name=ar(i,:);
comparisons(i-2, 1) = distance(refCld, index(i-2,:), 6, 3, 3);
comparisons(i-2, 2) = i-2;
compa(i-2)=name;
end
[B,k] = sort(comparisons(:,1));
% B = [B k];
fprintf(fo,'Retrieved list for query image %s',im);
for i=1:10
for j=1:2000
if(j == k(i) )
fprintf(fo,'%s\n',compa(j));
else ;
end
end
end
fprintf(fo,'\n');
end
% B = sort(comparisons(:,2));
%srcFiles = dir('..\UKentuckyDatabase\*.jpg');
toc