Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Poisson Surface Reconstruction (#1317)
* Poisson Surface Reconstruction * addressing CI warnings * disable -Werror * merge upstream * remove poisson files to setup submodule * PoissonRecon as submodule * Merge remote-tracking branch 'upstream/master' into poisson * fix and enable warning, and misc * use /W3 without /WX for windows * addressing review comments * added method to remove low density vertices
- Loading branch information
Showing
15 changed files
with
1,262 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule PoissonRecon
added at
fd273e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
examples/Python/Advanced/surface_reconstruction_poisson.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Open3D: www.open3d.org | ||
# The MIT License (MIT) | ||
# See license file or visit www.open3d.org for details | ||
|
||
# examples/Python/Advanced/surface_reconstruction_poisson.py | ||
|
||
import open3d as o3d | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import os | ||
|
||
import sys | ||
|
||
sys.path.append( | ||
os.path.join(os.path.dirname(os.path.realpath(__file__)), "../Misc")) | ||
import meshes | ||
|
||
if __name__ == "__main__": | ||
o3d.utility.set_verbosity_level(o3d.utility.VerbosityLevel.Debug) | ||
|
||
pcd = meshes.eagle() | ||
print(pcd) | ||
o3d.visualization.draw_geometries([pcd]) | ||
|
||
print('run Poisson surface reconstruction') | ||
mesh, densities = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson( | ||
pcd, depth=8) | ||
print(mesh) | ||
o3d.visualization.draw_geometries([mesh]) | ||
|
||
print('visualize densities') | ||
densities = np.asarray(densities) | ||
density_colors = plt.get_cmap('plasma')( | ||
(densities - densities.min()) / (densities.max() - densities.min())) | ||
density_colors = density_colors[:, :3] | ||
density_mesh = o3d.geometry.TriangleMesh() | ||
density_mesh.vertices = mesh.vertices | ||
density_mesh.triangles = mesh.triangles | ||
density_mesh.triangle_normals = mesh.triangle_normals | ||
density_mesh.vertex_colors = o3d.utility.Vector3dVector(density_colors) | ||
o3d.visualization.draw_geometries([density_mesh]) | ||
|
||
print('remove low density vertices') | ||
vertices_to_remove = densities < np.quantile(densities, 0.1) | ||
mesh.remove_vertices_by_mask(vertices_to_remove) | ||
print(mesh) | ||
o3d.visualization.draw_geometries([mesh]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.