I am using Python in VS code. I have gotten the basics down in reading, writing and visualizing point cloud files.
What I want to do now is update the point cloud visualization in real time.
I have tried many different approaches and read the documentation thoroughly. I am still struggling to get it working. Whenever the visualization window opens, it stops all other code from executing. I’ve noticed in the non-blocking visualization part of the documentation it says that the visualizer holds the process until it is closed.
I’ve tried some examples with call backs as well as making an object of the visualizer and calling add_geometry. I might have made some mistakes since that also did not work out.
Below is a very basic code snippet just to get the idea working. Essentially 2 random points are generated and visualized. Thereafter, some more points are generated. I would like to add them to the current visualization without closing the window or pressing any buttons. They should be added dynamically. Essentially this is to simulate points as they arrive from another source.
In advance, thank you very much for any help.
import open3d as o3d
import numpy as np
Generate two random points
randomPoints1 = np.random.rand(2, 3)
pointSet1 = o3d.geometry.PointCloud()
pointSet1.points = o3d.utility.Vector3dVector(randomPoints1)
Add more random points
randomPoints2 = np.random.rand(5, 3)
pointSet2 = o3d.geometry.PointCloud()
pointSet2.points = o3d.utility.Vector3dVector(randomPoints2)