-
Notifications
You must be signed in to change notification settings - Fork 0
/
Point.py
32 lines (25 loc) · 841 Bytes
/
Point.py
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
import numpy as np
class Point():
def __init__(self, cloud, pt4d, color):
self.pt4d = pt4d
self.pt3d = pt4d[:3]
self.frames = []
self.color = color
self.id = cloud.points_newid
cloud.points_newid += 1
cloud.points.append(self)
def orb(self):
f = self.frames[-1]
return f.des[f.pts.index(self)]
def delete(self):
for f in self.frames:
i = f.pts.index(self)
f.pts[i] = None
del self
def addObservation(self, frame, index):
if frame.pts[index] is None:
self.frames.append(frame)
frame.pts[index] = self
self.orb()
else:
print(f"frame {frame.id} kp {index} has P{frame.pts[index].id} - new P{self.id}")