Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open3d: How to update point cloud during window running?

CONTEXT

I'm trying to visualize 3d point cloud from disparity map. It works perfectly with one map.

ISSUE

I want to update what's in window. When I call run() method new thread is opened and I cannot do anything till the window will be closed. I'd like to clear what's in window and display new cloud without closing the window, so it would be something like animation.

CODE

I've created Visualizer object and I do everything on that.

    vis = open3d.visualization.Visualizer()
    vis.create_window()
    cloud = open3d.io.read_point_cloud(out_fn) # out_fn is file name
    vis.add_geometry(cloud)
    vis.run()
like image 420
MASTER OF CODE Avatar asked Oct 28 '25 02:10

MASTER OF CODE


1 Answers

The class open3d.visualization.Visualizer has .update_geometry() and .remove_geometry() function you can use to achieve that. Another way around you can try is using open3d.visualization.VisualizerWithKeyCallback class.

vis = o3d.visualization.VisualizerWithKeyCallback()
cloud = open3d.io.read_point_cloud(out_fn)
vis.create_window()
vis.register_key_callback(key, your_update_function)
vis.add_geometry(cloud)
vis.run()

def your_update_function():
    #Your update routine
    vis.update_geometry(cloud)
    vis.update_renderer()
    vis.poll_events()
    vis.run()
like image 158
JotaCe7 Avatar answered Oct 30 '25 18:10

JotaCe7