簡體   English   中英

Open3d:如何在 window 運行期間更新點雲?

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

語境

我試圖從視差 map 中可視化 3d 點雲。 它與一台 map 完美配合。

問題

我想更新 window 中的內容。 當我調用 run() 方法時,新線程被打開並且在 window 關閉之前我什么也做不了。 我想清除 window 中的內容並在不關閉 window 的情況下顯示新雲,所以它類似於 animation。

代碼

我已經創建了 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()

class open3d.visualization.Visualizer has.update_geometry() 和.remove_geometry() function 可以用來實現這一點。 您可以嘗試的另一種方法是使用 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