当前位置:网站首页>Open3d learning note 4 [surface reconstruction]
Open3d learning note 4 [surface reconstruction]
2022-07-02 07:54:00 【Silent clouds】
open3d Surface reconstruction
Alpha shapes
Reconstruction with convex hull .
import open3d as o3d
mesh_ply = o3d.io.read_triangle_mesh("mode/bunny.ply")
# sampling
pcd = mesh_ply.sample_points_poisson_disk(750)
# Take a look at the convex hull
hull, _ = pcd.compute_convex_hull()
hull_ls = o3d.geometry.LineSet.create_from_triangle_mesh(hull)
hull_ls.paint_uniform_color((1, 0, 0))
o3d.visualization.draw_geometries([pcd, hull_ls], width=1280, height=720)
# Start surface reconstruction ,alpha Adjustable value
alpha = 0.1
print(f"alpha={alpha:.3f}")
mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape(pcd, alpha)
mesh.compute_vertex_normals()
print(mesh)
o3d.visualization.draw_geometries([mesh], mesh_show_back_face=True, width=1280, height=720)
result :
Convex hull condition
Reconstruction effect ,Alpha=0.1
continue ,Alpha = 0.015
Rolling ball method
import open3d as o3d
mesh = o3d.io.read_triangle_mesh("mode/bunny.ply")
mesh.compute_vertex_normals()
# Old rules , Sample first
pcd = mesh.sample_points_poisson_disk(3000)
# Here you can see the normal
o3d.visualization.draw_geometries([pcd], point_show_normal=True, width=1280, height=720)
# Start rebuilding
radii = [0.005, 0.01, 0.02, 0.04]
rec_mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_ball_pivoting(pcd, o3d.utility.DoubleVector(radii))
o3d.visualization.draw_geometries([pcd, rec_mesh], width=1280, height=720)
effect :
Normal annotation
Reconstruction effect
Poisson surface reconstruction
The two above , The rolling ball method looks good , But in fact, both are chicken ribs , Is not smooth . Poisson reconstruction will be better in this regard .
There is only one adjustable parameter for Poisson surface reconstruction , That's it depth, This defines the depth of the octree , If the value is high, there will be more details .
import open3d as o3d
mesh = o3d.io.read_triangle_mesh("mode/Fantasy Dragon.ply")
mesh.compute_vertex_normals()
pcd = mesh.sample_points_poisson_disk(3000)
with o3d.utility.VerbosityContextManager(o3d.utility.VerbosityLevel.Debug) as cm:
mesh, densities = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(pcd, depth=9)
# Paint him a color
mesh.paint_uniform_color([1, 0, 0])
o3d.visualization.draw_geometries([mesh], zoom=0.664,
front=[-0.4761, -0.4698, -0.7434],
lookat=[1.8900, 3.2596, 0.9284],
up=[0.2304, -0.8825, 0.4101],
width=1280,
height=720)
Next, let's go through the process , Look at the density of points .
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], zoom=0.664,
front=[-0.4761, -0.4698, -0.7434],
lookat=[1.8900, 3.2596, 0.9284],
up=[0.2304, -0.8825, 0.4101],
width=1280,
height=720)
Purple is low density , Yellow is high density , You can screen out some with low density . give the result as follows :
There seems to be no change . Sampling point 3000 In the case of reconstruction , There are still some scattered noises . To remove noise , There are two ways : The first one is : Continue to reduce sampling points ; The second kind , Increase sampling point . Reducing sampling points will lose more details , So it's not recommended .
Let's see the effect of increasing sampling points .
Sampling point =10000
Almost restored the original appearance , But what if the low-density area is removed ?
Become incomplete . So use the delete function depending on the situation .
Let's take a look at reducing sampling points .
Sampling point =1000
As expected , Although the original scattered points are gone , But at the same time, many details have been lost , Do more harm than good .
Next, change the model to see the reconstruction effect .
Sampling point 15000
Close to the limit , Even the sampling points basically cover the whole model , Some details will still be lost .
边栏推荐
- 【Sparse-to-Dense】《Sparse-to-Dense:Depth Prediction from Sparse Depth Samples and a Single Image》
- Convert timestamp into milliseconds and format time in PHP
- Pointnet understanding (step 4 of pointnet Implementation)
- win10+vs2017+denseflow编译
- Mmdetection trains its own data set -- export coco format of cvat annotation file and related operations
- 【Mixup】《Mixup:Beyond Empirical Risk Minimization》
- 浅谈深度学习中的对抗样本及其生成方法
- Faster-ILOD、maskrcnn_ Benchmark installation process and problems encountered
- 用MLP代替掉Self-Attention
- MMDetection安装问题
猜你喜欢
【Mixup】《Mixup:Beyond Empirical Risk Minimization》
Graph Pooling 简析
[multimodal] clip model
Deep learning classification Optimization Practice
超时停靠视频生成
【Batch】learning notes
【雙目視覺】雙目矯正
Open3D学习笔记一【初窥门径,文件读取】
【Mixed Pooling】《Mixed Pooling for Convolutional Neural Networks》
【Sparse-to-Dense】《Sparse-to-Dense:Depth Prediction from Sparse Depth Samples and a Single Image》
随机推荐
【Hide-and-Seek】《Hide-and-Seek: A Data Augmentation Technique for Weakly-Supervised Localization xxx》
Common machine learning related evaluation indicators
Replace self attention with MLP
【学习笔记】Matlab自编高斯平滑器+Sobel算子求导
label propagation 标签传播
Apple added the first iPad with lightning interface to the list of retro products
Label propagation
浅谈深度学习中的对抗样本及其生成方法
Memory model of program
【Paper Reading】
(15) Flick custom source
超时停靠视频生成
Generate random 6-bit invitation code in PHP
Faster-ILOD、maskrcnn_ Benchmark installation process and problems encountered
图像增强的几个方法以及Matlab代码
【Mixed Pooling】《Mixed Pooling for Convolutional Neural Networks》
MoCO ——Momentum Contrast for Unsupervised Visual Representation Learning
ABM thesis translation
open3d学习笔记三【采样与体素化】
Open3D学习笔记一【初窥门径,文件读取】