update_geometry(mesh) did not work when I wanted to update the visualizer with a new reconstructed surface mesh
- Dominant language
- C++
- Stars
- 14k
- Forks
- 2.6k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 6
Description
**Describe the bug**
I wanted to update the mesh in the o3d.visualization.Visualizer by a non-blocking way, so I used update_geometry(new_mesh) function, however, though the new mesh was produced, the new mesh was never updated in the visualization window. Thus I am wondering whether it is a bug or my wrong use of the function. following is my code:
```
vis = o3d.visualization.Visualizer()
vis.create_window()
opt = vis.get_render_option()
opt.background_color = np.asarray([255, 255, 255])
opt.point_size = 1
opt.show_coordinate_frame = True
# vis.add_geometry(point_cloud)
point_cloud.estimate_normals()
# change the direction of the estimated normals
for index1,normal in enumerate(point_cloud.normals):
for index2,vec in enumerate(normal):
normal[index2] = -vec
# reconstruct the surface by Possion method
with o3d.utility.VerbosityContextManager(o3d.utility.VerbosityLevel.Debug) as cm:
mesh, densities = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(point_cloud,depth=4)
# o3d.visualization.draw_geometries([mesh])
mesh.compute_vertex_normals() # 计算当前mesh的顶点及法线
mesh.paint_uniform_color([1, 0.706, 0])
mesh = mesh.subdivide_loop(number_of_iterations=2)
# o3d.visualization.draw_geometries(mesh) # static visualization
vis.add_geometry(mesh)
while True:
try:
#get new pointcloud ( ellipsis... )
point_cloud.estimate_normals()
# change the direction of the estimated normals
for index1, normal in enumerate(point_cloud.normals):
for index2, vec in enumerate(normal):
normal[index2] = -vec
# reconstruct the surface by Possion method
with o3d.utility.VerbosityContextManager(o3d.utility.VerbosityLevel.Debug) as cm:
mesh, densities = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(point_cloud,depth = 4)
mesh.compute_vertex_normals() # 计算当前mesh的顶点及法线
mesh.paint_uniform_color([1, 0.706, 0])
vis.update_geometry(mesh)
vis.poll_events()
vis.update_renderer()
except KeyboardInterrupt:
vis.destroy_window()
print('exit.')
break
except Exception:
continue
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.