Suppose we have a sequence of .pcd
files in the directory point_clouds
:
01.pcd
02.pcd
...
10.pcd
I am trying to visualize those files as a video (and potentially save them as a *mp4/avi
). I tried two methods:
- Inspired by the Non-blocking visualization guide, this is the code I made:
import open3d as o3d
from pathlib import Path
pcs_path = Path("point_clouds")
pcd = o3d.io.read_point_cloud(str(pcs_path.joinpath("01.pcd")))
vis = o3d.visualization.Visualizer()
vis.create_window()
vis.add_geometry(pcd)
for p in pcs_path.iterdir():
pcd = o3d.io.read_point_cloud(str(p))
vis.update_geometry(pcd)
vis.poll_events()
vis.update_renderer()
vis.destroy_window()
The issue is that the video is stuck on the very first point cloud, without changing. I was wondering if I should update the pcd
"inplace".
- I used the draw_geometries_with_custom_animation(...) method:
list_of_pcs = [o3d.io.read_point_cloud(str(p)) for p in pcs_path.iterdir()]
o3d.visualization.draw_geometries_with_custom_animation(list_of_pcs)
The issue here is that instead of a sequence, all point clouds are shown simultaneously.