-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgaussian_viewer.py
executable file
·60 lines (51 loc) · 2 KB
/
gaussian_viewer.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python3
import numpy as np
from gsplat.gau_io import *
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), 'viewer'))
from viewer import *
from custom_items import *
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--gs", help="the input gs path")
args = parser.parse_args()
cam_2_world = np.array([[1, 0, 0], [0, 0, 1], [0, -1, 0]])
if args.gs:
print("Try to load %s ..." % args.gs)
gs = load_gs(args.gs)
rotate_gaussian(cam_2_world, gs)
else:
gs_data = np.array([[0., 0., 0., # xyz
1., 0., 0., 0., # rot
0.05, 0.05, 0.05, # size
1.,
1.772484, -1.772484, 1.772484],
[1., 0., 0.,
1., 0., 0., 0.,
0.2, 0.05, 0.05,
1.,
1.772484, -1.772484, -1.772484],
[0., 1., 0.,
1., 0., 0., 0.,
0.05, 0.2, 0.05,
1.,
-1.772484, 1.772484, -1.772484],
[0., 0., 1.,
1., 0., 0., 0.,
0.05, 0.05, 0.2,
1.,
-1.772484, -1.772484, 1.772484]
], dtype=np.float32)
# ply_fn = "/home/liu/workspace/gaussian-splatting/output/a531e75d-7/point_cloud/iteration_30000/point_cloud.ply"
# gs = load_ply(ply_fn, cam_2_world)
gs_data = gs.view(np.float32).reshape(gs.shape[0], -1)
app = QApplication([])
gs_item = GaussianItem()
grid_item = GridItem()
items = {"gs": gs_item, "grid": grid_item}
viewer = Viewer(items)
viewer.items["gs"].setData(gs_data=gs_data)
viewer.show()
app.exec_()