简体   繁体   English

Open3d:如何在 window 运行期间更新点云?

[英]Open3d: How to update point cloud during window running?

CONTEXT语境

I'm trying to visualize 3d point cloud from disparity map.我试图从视差 map 中可视化 3d 点云。 It works perfectly with one map.它与一台 map 完美配合。

ISSUE问题

I want to update what's in window.我想更新 window 中的内容。 When I call run() method new thread is opened and I cannot do anything till the window will be closed.当我调用 run() 方法时,新线程被打开并且在 window 关闭之前我什么也做不了。 I'd like to clear what's in window and display new cloud without closing the window , so it would be something like animation.我想清除 window 中的内容并在不关闭 window 的情况下显示新云,所以它类似于 animation。

CODE代码

I've created Visualizer object and I do everything on that.我已经创建了 Visualizer object,我在上面做了所有事情。

    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()

The class open3d.visualization.Visualizer has.update_geometry() and.remove_geometry() function you can use to achieve that. class open3d.visualization.Visualizer has.update_geometry() 和.remove_geometry() function 可以用来实现这一点。 Another way around you can try is using open3d.visualization.VisualizerWithKeyCallback class.您可以尝试的另一种方法是使用 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()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM