File size: 657 Bytes
71fb836 |
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 |
import viser
import open3d as o3d
import numpy as np
import sys
import time
if len(sys.argv) < 2:
print("Usage: python vis.py <path_to_pcd_file>")
sys.exit(1)
pcd_file = sys.argv[1]
pcd = o3d.io.read_point_cloud(pcd_file)
points = np.asarray(pcd.points)
colors = np.asarray(pcd.colors).astype(float) if pcd.has_colors() else None
# 启动 Viser 服务器
server = viser.ViserServer(port=8088) # 可自定义端口
server.scene.background_color = (0.1, 0.1, 0.1)
# 添加点云
server.add_point_cloud(
name="/pointcloud",
points=points,
colors=colors,
point_size=0.003,
)
# Keep the script running
while True:
time.sleep(0.1) |