Add multiple geometries to VisualizerWithEditing class
It would be nice to be able to add multiple geometries to the VisualizerWithEditing class where the geometries can be PointCloud or say TriangleMesh. Currently this doesn't seem to be the case. Any ideas on how to do it?
An example use case can be like this:
def draw_geometries_pick_points(geometries):
vis = VisualizerWithEditing()
vis.create_window()
for geometry in geometries:
vis.add_geometry(geometry)
vis.run()
vis.destroy_window()
Say we have a point cloud and some mesh objects that are used to enclose points like a bounding box, with the Visualizer class, one can add geometries and get the complete visualization as shown below
But with the VisualizerWithEditing class, despite adding geometries using add_geometry, only the first geometry object is visualized. So, if the PointCloud was the first to be added, then we get only
Thanks, @amrit110 for pointing out the issue with nice examples. Technically VisualizerWithEditing should run exactly as the same as Visualizer, but it looks something went wrong. I am working for this issue.
The issue turns out to be non-trivial as VisualizerWithEditing is designed for point cloud.
Let's get back to the question. add_geometry ignores the second call of add_geometry due to the below lines:
https://github.com/IntelVCL/Open3D/blob/c9aab50f15e74aaaa9c30e190a143340d9a1a3ec/src/Visualization/Visualizer/VisualizerWithEditing.cpp#L46-L51
If you remove || geometry_ptrs_.empty() == false you should be able to see point both cloud and mesh.
Another issue is that pick_point does not support meshes. For example the below lines,
https://github.com/IntelVCL/Open3D/blob/c9aab50f15e74aaaa9c30e190a143340d9a1a3ec/src/Visualization/Visualizer/VisualizerWithEditing.cpp#L185-L187
Only initializes PointCloudPickingRenderer.
@qianyizh: I would like to ask your opinion. Do you think it is feasible to reuse point picking functions for meshes?
Ah I see. Thanks! I can now pick points that belong to the point cloud while visualizing all the geometries. Point picking for meshes seems like a useful feature, since one might want to select intermediate points on the meshes. Can this be generalized to creating an arbitrary point to be picked? So say that I wish to actually get the location of a point that might be close to an existing point, I could create a point to do this, thereby also picking it. I would imagine this to be a quite a useful feature. But, this seems very much non-trivial and might be quite some work, since creating a point based on where the mouse click is done is not obvious to me. But if you have ideas on that I would be interested to spend time trying to implement it.
That's a great idea. Actually, I was thinking about re-using the current implementation for picking vertices in a mesh. That will just find the most adjacent points likewise it worked for point clouds. However, I agree with your idea. The most reasonable way for mesh is to find the three vertices that wraps the user provided point, and apply barycentric interpolation to estimate 3D position of the user provided point.
This will going to be interesting feature. I would be glad if you can contribute!
A workaround I used is to simply create a point cloud from the mesh, and render it jointly with the mesh. The picker works for the point cloud.
@syncle thanks. ill start looking into it since I would really like to be able to have user defined points, though might take a while to understand how to do it.
A workaround I used is to simply create a point cloud from the mesh, and render it jointly with the mesh. The picker works for the point cloud.
Hi, would you please share the way to ' render it jointly' ?
Is this gonna be solved in the official release?
Time to close this, since the new visualization system is around the corner.
May I know the the updates?
I have still this issue on version 0.10.0.0 on linux ubuntu 18.04 LTS, should it have been solved?
I'm facing this problem too. I add the point cloud and the mesh together, but only one of them shows up.
@letatanu the old visualizer (VisualizerWithEditing and friends) is deprecated and no work is being done on them. You can use the open3d.visualization.draw() function for many tasks, see examples/python/gui/draw.py for some of thing things you can do. If you would like to use the underlying open3d.visualization.O3DVisualizer class directly, the code for the draw() function is a good illustration at python/open3d/visualization/draw.py.
Thank you @prewettg. That works well for the visualization. The only problem with it is that it cannot display the texture for obj file. I'm ok with that.
@letatanu We've made it easier to display complex triangle mesh models from files like OBJ with the upcoming 0.13 release. Use open3d.io.read_triangle_model() instead of open3d.io.read_triangle_mesh() and pass it in to the visualizer just like you would with a regular triangle mesh. If the Open3D app loads it textured, then read_triangle_model() will, as well. However, many model files have incorrect paths for the textures, or incorrect material specifications, so if it does not load in the viewer, you may need to edit the OBJ file and correct it.
(If it is the point cloud that you want textured, you will need to assign the appropriate colors to the colors array of the point cloud; you can see some examples of this in the draw.py example referenced above.)
It's 2022 now but the issue is still there... VisualizerWithEditing.add_geometry can only take one PointCloud...
As noted above, we are no longer working on the old visualizer so we will not be adding new functionality to it. However, we will be adding to the new visualizer any features that are missing.
Is there a guide how to use the new API for what you would previously use the VisualizerWithEditing for?
Is there any update on this? I find only references to this "new API" but no actual documentation or guides for which functions to use
Same here; the documentation is confusing. Before the point annotation would do something like
vis = o3d.visualization.VisualizerWithEditing()
vis.create_window()
vis.add_geometry(cloud)
vis.run()
vis.destroy_window()
return vis.get_picked_points()
How can you enable the points picking and returning vis.get_picked_points() from vis.o3d.visualization.draw(mesh)?