-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
36 lines (28 loc) · 825 Bytes
/
main.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
33
34
35
36
import mayavi.mlab
import torch
import numpy as np
path_bin = './data/000000.bin'
myPC = np.fromfile(path_bin, dtype=np.float32, count=-1).reshape([-1, 4])
myPC = torch.from_numpy(myPC)
print(myPC.size())
print(myPC.type())
def viz_mayavi(points, vals="distance"):
x = points[:, 0]
y = points[:, 1]
z = points[:, 2]
r = points[:, 3]
d = torch.sqrt(x ** 2 + y ** 2)
if vals == "height":
col = z
else:
col = d
fig = mayavi.mlab.figure(bgcolor=(0, 0, 0), size=(1280, 720))
mayavi.mlab.points3d(x, y, z,
col,
mode="point",
colormap='spectral',
figure=fig,
)
mayavi.mlab.show()
if __name__ == '__main__':
viz_mayavi(myPC, vals='height')