-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfindMatch.m
More file actions
102 lines (80 loc) · 2.26 KB
/
Copy pathfindMatch.m
File metadata and controls
102 lines (80 loc) · 2.26 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
function matchedPair = findMatch(worldFv, imageFv, gain , maxMatchingThreshold, maxVote,nbrPoints)
%% Unit Test Matrix Input:
% %%
%
% imageFv = [
% 33
% 47.076337
% 52.157628
% 90.257818
% 110.793726
% 191.726510
% 212.420945 ];
% imageFv = imageFv' ;
% worldFv = [
% 37
% 53.454327
% 56.519567
% 94.576676
% 105.734315
% 176.929878
% 187.075594 ] ;
% worldFv = worldFv' ;
% maxVote = size(worldFv,2)-2;
% gain = 100 ;
% maxMatchingThreshold = gain * 0.05;
% maxVote =
%% Input Check
%%
if nargin ~=6
disp('findMatch: Function call error');
end
% To check if each feature vector has same elements
if( size(worldFv,2) ~= size(imageFv,2 ) )
disp('Feature Vector Calculation has screwed up');
matchedPair = zeros(1);
end
%%
%% The Real Job
%%
nWorldPoints = size(worldFv,1);
nFvSize = size(worldFv,2) - 1;
nImagePoints = size(imageFv,1);
pairStart = 1;
% Default no match found assignment
matchedPair(pairStart,:) = [ 666 666 666];
if(gain > 1)
imageFv = [imageFv(:,1) imageFv(:,2:end) .* gain ];
worldFv = [worldFv(:,1) worldFv(:,2:end) .* gain ];
end
for i = 1:nImagePoints
% Image point i to consider
imagePoint = imageFv(i,:);
% Save id of the point
imagePointID = imagePoint(1,1);
% Save vectore from the point
imagePointFv = imagePoint(1,2:end);
for j = 1:nWorldPoints
% World point j to consider for this iteration
worldPoint = worldFv(j,:);
% Save ID and Vector
worldPointID = worldPoint(1,1);
worldPointFv = worldPoint(1,2:end);
%%Stopped sorting
%imagePointFv = sort(imagePointFv);
%worldPointFv = sort(worldPointFv);
% Feature matching of point Image(i) vs World(j)
if( imagePointID == worldPointID )
test = 1;
end
voteCount = voting2(imagePointFv,worldPointFv,nFvSize,maxMatchingThreshold);
% voteCount = voting2(imagePointFv,worldPointFv,nFvSize,maxMatchingThreshold,nbrPoints);
%Test
% voteCount = nFvSize-1;
if(voteCount >= maxVote)
matchedPair(pairStart,:) = [worldPointID imagePointID voteCount];
pairStart = pairStart +1 ;
end
end
end
end