Skip to content
Advertisement

Playing sequence of ply files in open3d

I’m currently trying to play a sequence of ply models through open3d, but I’m having some issues with updating the geometry. Currently only the first image is shown, and the vis isn’t being updated. I’ve been trying to find some info on this, but most guides or other sections show that this should work? I’m not entirely sure what I’m doing wrong but any advice would be greatly appreciated.

I’m currently using python==3.9 and open3d==14.1.

pcd = o3d.io.read_point_cloud(testdata_directory + str(1) + ".ply")
vis = o3d.visualization.Visualizer()
vis.create_window()
vis.add_geometry(pcd)
for i in range(1, 100):
    pcd = o3d.io.read_point_cloud(testdata_directory + str(i) + ".ply")
    vis.update_geometry(pcd)
    vis.poll_events()
    vis.update_renderer()

Advertisement

Answer

I’m not sure why but this works (got the solution from Open3d – visualizing multiple point clouds as a video/animation)

import open3d as o3d
from time import sleep

frames = 682

vis = o3d.visualization.Visualizer()
vis.create_window()

pcd = o3d.io.read_point_cloud(f'ply/0000000.ply')
vis.add_geometry(pcd)
vis.poll_events()
vis.update_renderer()

for i in range(1, frames):
    pcd.points = o3d.io.read_point_cloud(f'ply/{i:07d}.ply').points
    vis.update_geometry(pcd)
    vis.poll_events()
    vis.update_renderer()
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement