docs/jupyter/visualization/draw_plotly.ipynb
import open3d as o3d
#draw a point cloud with default parameter
dataset = o3d.data.PLYPointCloud()
office = o3d.io.read_point_cloud(dataset.path)
o3d.visualization.draw_plotly([office])
#we can downsample these points to speed up visualization by adjusting
# point_sample_factor to a smaller number
dataset = o3d.data.PLYPointCloud()
office = o3d.io.read_point_cloud(dataset.path)
o3d.visualization.draw_plotly([office], point_sample_factor=0.1)
#adjust the camera to get a better view
dataset = o3d.data.PLYPointCloud()
office = o3d.io.read_point_cloud(dataset.path)
o3d.visualization.draw_plotly([office],
point_sample_factor=0.1,
zoom=0.3,
front=[0.4257, -0.2125, -0.8795],
lookat=[2.672, 2.0475, 1.532],
up=[-0.0694, -0.9768, -0.2024])
#draw a triangle mesh
dataset = o3d.data.BunnyMesh()
mesh = o3d.io.read_triangle_mesh(dataset.path)
o3d.visualization.draw_plotly([mesh],
up=[0, 1, 0],
front=[0, 0, 1],
lookat=[0.0, 0.1, 0.0],
zoom=0.5)
#draw a triangle mesh with wireframes.
dataset = o3d.data.BunnyMesh()
mesh = o3d.io.read_triangle_mesh(dataset.path)
o3d.visualization.draw_plotly([mesh],
mesh_show_wireframe=True,
up=[0, 1, 0],
front=[0, 0, 1],
lookat=[0.0, 0.1, 0.0],
zoom=0.5)
#draw a point set
points = [
[0, 0, 0],
[1, 0, 0],
[0, 1, 0],
[1, 1, 0],
[0, 0, 1],
[1, 0, 1],
[0, 1, 1],
[1, 1, 1],
]
lines = [
[0, 1],
[0, 2],
[1, 3],
[2, 3],
[4, 5],
[4, 6],
[5, 7],
[6, 7],
[0, 4],
[1, 5],
[2, 6],
[3, 7],
]
colors = [[1, 0, 0] for i in range(len(lines))]
line_set = o3d.geometry.LineSet(
points=o3d.utility.Vector3dVector(points),
lines=o3d.utility.Vector2iVector(lines),
)
line_set.colors = o3d.utility.Vector3dVector(colors)
o3d.visualization.draw_plotly([line_set])