-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsiftMatch.m~
35 lines (29 loc) · 1016 Bytes
/
siftMatch.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
function [matches] = siftMatch(desc1, desc2, ratio)
%function [matches] = briefMatch(desc1, desc2, ratio)
% Performs the descriptor matching
% inputs : desc1 , desc2 - m1 x n and m2 x n matrix. m1 and m2 are the number of keypoints in image 1 and 2.
% n is the number of bits in the brief
% outputs : matches - p x 2 matrix. where the first column are indices
% into desc1 and the second column are indices into desc2
if nargin<3
<<<<<<< HEAD
ratio = .;
=======
ratio = .7;
>>>>>>> 5dc9d5f515babe0140f91bc4ea2a6b668de3ceee
end
% compute the pairwise Hamming distance
[D,I] = pdist2(desc2,desc1,'cityblock','Smallest',2);
ix = 1:size(desc1,1);
% suprress match between descriptors that are not distriminative.
r = D(1,:)./D(2,:);
<<<<<<< HEAD
ix = ix(r < ratio | isnan(r));
I2 = I(1,r < ratio | isnan(r));
=======
ix = ix((r < ratio)& D(1,:)<2 | isnan(r));
I2 = I(1,(r < ratio)& D(1,:)<2| isnan(r));
>>>>>>> 5dc9d5f515babe0140f91bc4ea2a6b668de3ceee
%output
matches = [ix' I2'];
end