I'm updating a point cloud from a depth camera stream and I'd like to create a basic UI for a bounding box to crop the point cloud.
I've made progress using open3d.visualization.VisualizerWithKeyCallback
but I haven't figured out a way to get access to the window it creates. (VisualizerWithKeyCallback's create_window()
simply returns a boolean).
I've also tried adapting the Open3D video example, however it's unclear how I would adapt the add_geometry()
/ update_geometry()
approach I used with VisualizerWithKeyCallback
as Open3DScene
works differently.
For example, here's how I've attempted to add the pointcloud:
def _update_thread(self):
# This is NOT the UI thread, need to call post_to_main_thread() to update
# the scene or any part of the UI.
while not self.is_done:
time.sleep(0.100)
if new_frame_is_valid:
self.point_cloud_o3d.points = o3d.utility.Vector3dVector(points_np)
# Update the images. This must be done on the UI thread.
def update():
if self.frame_count == 1:
self.widget3d.scene.add_geometry('original point cloud', self.point_cloud_o3d, self.lit)
print('added geometry')
if not self.is_done:
gui.Application.instance.post_to_main_thread(
self.window, update)
self.frame_count += 1
This results in it appears to be blank window which turns black whenever I try to zoom/rotate.
Additionally I've thought about using the multiple_windows example however this simply crashes with my setup (Windows 11, Python 3.6.4, Open3D 0.15.1).
What's the simplest method of creating a basic UI using Open3D using a point cloud that needs constant updating (e.g. from a live depth camera) ?