-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmatch_features.m
More file actions
63 lines (31 loc) · 1.08 KB
/
match_features.m
File metadata and controls
63 lines (31 loc) · 1.08 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function [matches, confidences] = match_features(features1, features2)
ratio = 0.8;
num_matches = 0;
num_features1 = size(features1,1);
num_features2 = size(features2,1);
matches = zeros(num_features1,2);
confidences = zeros(num_features1);
for i = 1:num_features1
distances = dist(features1(i,:),features2');
[dists,index] = sort(distances);
nndr = dists(1)/dists(2);
if nndr < ratio
%num_matches = num_matches + 1;
matches(i,:) = [i,index(1)];
confidences(i) = 1 - nndr;
% else
% confidences(i) = [];
% matches(i,:) = [];
end
end
if 0
%keep only those matched
matches_index = find(confidences>0);
matches = matches(matches_index,:);
confidences = confidences(matches_index);
% Sort the matches so that the most confident onces are at the top of the
% list. You should probably not delete this, so that the evaluation
% functions can be run on the top matches easily.
%[confidences, ind] = sort(confidences, 'descend');
%matches = matches(ind,:);
end