-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (35 loc) · 929 Bytes
/
main.py
File metadata and controls
44 lines (35 loc) · 929 Bytes
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
from slam import process
from display import Display
from pointmap import PointMap
import cv2
import open3d as o3d
pmap = PointMap()
display = Display()
def main():
cap = cv2.VideoCapture("videos/test_video3.mp4")
pcd = o3d.geometry.PointCloud()
visualizer = o3d.visualization.Visualizer()
visualizer.create_window(window_name="3D plot", width=960, height=540)
while cap.isOpened():
ret, frame = cap.read()
frame = cv2.resize(frame, (960, 540))
img, tripoints, kpts, matches = process(frame)
xyz = pmap.collect_points(tripoints)
if ret:
if kpts is not None or matches is not None:
display.display_points2d(frame, kpts, matches)
else:
pass
display.display_vid(frame)
if xyz is not None:
display.display_points3d(xyz, pcd, visualizer)
else:
pass
if cv2.waitKey(1) == 27:
break
else:
break
cv2.destroyAllWindows()
cap.release()
if __name__ == '__main__':
main()