-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenVisMap.m
52 lines (43 loc) · 1.32 KB
/
genVisMap.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
46
47
48
49
50
51
52
function Vmap = genVisMap(cam)
% initial settings
Vmap = cam{1}.match{2};
matches = Vmap(1,:);
pcloud = cam{1}.pts;
idRM_1 = findRmPts(pcloud, matches);
pcloud = cam{2}.pts;
matches = Vmap(2,:);
idRM_2 = findRmPts(pcloud, matches);
padd_length_1 = length(find(idRM_1 > 0));
padd_length_2 = length(find(idRM_2 > 0));
temp = zeros(2, padd_length_1 + padd_length_2);
temp(1,1:padd_length_1) = find(idRM_1 == 1);
temp(2,padd_length_1 + 1: end) = find(idRM_2 == 1);
Vmap = [Vmap temp];
for i = 2:29
matchesPre = cam{i-1}.match{i};
matches = cam{i}.match{i+1};
%numMatches = size(matches, 2);
temp = zeros(1, size(Vmap, 2));
for j = 1:size(matches,2)
index = find(Vmap(i,:) == matches(1,j));
if ~isempty(index)
temp(1, index) = matches(2,j);
end
end
pcloud = cam{i+1}.pts;
% idMatch = zeros(1, size(pcloud,2));
% idMatch(matches(2,:)) = idMatch(matches(2,:)) + 1;
% idRM = 1 - idMatch;
fprintf('%d...\n', i);
idRM = findRmPts(pcloud, matches(2,:));
padd_length = length(find(idRM > 0));
Vmap = [Vmap zeros(size(Vmap,1),padd_length)];
temp = [temp find(idRM == 1)];
Vmap = [Vmap; temp];
end
end
function idRM = findRmPts(pcloud, matches)
idMatch = zeros(1, size(pcloud,2));
idMatch(matches) = idMatch(matches) + 1; % (2,:)
idRM = 1 - idMatch;
end