-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeatures_intersection_in_frame1_frame2.m
74 lines (37 loc) · 1.29 KB
/
features_intersection_in_frame1_frame2.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function [n,pts1_n,pts2_n,pts1,pts2]=features_intersection_in_frame1_frame2(features,map_camera_times,cam_id1,cam_id2,frame1,frame2)
timestamp1=map_camera_times(frame1,1)-map_camera_times(frame1,3);
timestamp2=map_camera_times(frame2,1)-map_camera_times(frame2,3);
allKeys = keys(features);
n=0;
pts1_n=[];
pts2_n=[];
pts1=[];
pts2=[];
for i = 1:length(allKeys)
key = allKeys{i}; % 获取当前键
feat = features(key);
frame1_timestamps=0;
if size(feat.timestamps{cam_id1},1)>1
for j=1:size(feat.timestamps{cam_id1},1)
if timestamp1==feat.timestamps{cam_id1}(j)
frame1_timestamps=j;
end
end
end
frame2_timestamps=0;
if size(feat.timestamps{cam_id2},1)>1
for j=1:size(feat.timestamps{cam_id2},1)
if timestamp2==feat.timestamps{cam_id2}(j)
frame2_timestamps=j;
end
end
end
if frame1_timestamps~=0 && frame2_timestamps~=0
n=n+1;
pts1_n=[pts1_n;feat.uvs_norm{cam_id1}(frame1_timestamps,:)];
pts2_n=[pts2_n;feat.uvs_norm{cam_id2}(frame2_timestamps,:)];
pts1=[pts1;feat.uvs{cam_id1}(frame1_timestamps,:)];
pts2=[pts2;feat.uvs{cam_id2}(frame2_timestamps,:)];
end
end
end