Open3D Visualization of multiple geometries

today I have started with Open3D and I don't really know how to display more than one Geometry object in one scene/window.

When I run my code I have two different and separate windows(first with point cloud, second with lines). How should I use visualization.draw_geometries to display them two in one scene?

xyz = np.genfromtxt('file.csv', delimiter=',') print (xyz) pcd = o3d.geometry.PointCloud() pcd.points = o3d.utility.Vector3dVector(xyz) print(np.asarray(pcd.points)) o3d.visualization.draw_geometries_with_editing([pcd]) choosen_points = [[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 0, 1], [1, 0, 1], [0, 1, 1], [1, 1, 1]] lines = [[0, 1], [0, 2], [1, 3], [2, 3], [4, 5], [4, 6], [5, 7], [6, 7], [0, 4], [1, 5], [2, 6], [3, 7]] colors = [[1, 0, 0] for i in range(len(lines))] line_set = o3d.geometry.LineSet() line_set.points = o3d.utility.Vector3dVector(choosen_points) line_set.lines = o3d.utility.Vector2iVector(lines) line_set.colors = o3d.utility.Vector3dVector(colors) o3d.visualization.draw_geometries([line_set]) 

1 Answer

o3d.visualization.draw_geometries expects a list of geometries as an argument. You are currently calling the function twice, which results in two windows opening. To simultaneously draw both geometries, you just need to combine them in a single list, like so:

o3d.visualization.draw_geometries([pcd, line_set]) 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like