当前位置:网站首页>open3d学习笔记四【表面重建】
open3d学习笔记四【表面重建】
2022-07-02 06:26:00 【寂云萧】
open3d表面重建
Alpha shapes
利用凸包搞得重建。
import open3d as o3d
mesh_ply = o3d.io.read_triangle_mesh("mode/bunny.ply")
# 采样
pcd = mesh_ply.sample_points_poisson_disk(750)
# 看一下凸包情况
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)
#开始表面重建,alpha值可调
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)
结果:
凸包情况
重建效果,Alpha=0.1
继续,Alpha = 0.015
滚球法
import open3d as o3d
mesh = o3d.io.read_triangle_mesh("mode/bunny.ply")
mesh.compute_vertex_normals()
#老规矩,先采样
pcd = mesh.sample_points_poisson_disk(3000)
#这里可以看到法线
o3d.visualization.draw_geometries([pcd], point_show_normal=True, width=1280, height=720)
#开始重建
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)
效果:
法线标注情况
重建效果
泊松表面重建
上面两种,滚球法看上去还不错,但实际上两个都很鸡肋,不够平滑。这方面泊松重建会好一点。
泊松表面重建可调节参数只有一个,那就是depth,这是定义八叉树深度的,数值高的话细节会更多一点。
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)
#给他涂个颜色
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)

接下来走个流程,看看点的密度。
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)

紫色是低密度,黄色是高密度,可以筛出一些点密度低的。结果如下:
看似没什么变化。采样点3000的情况下重建,依旧存在一些散点噪点。要去除噪点,有两种办法:第一种:继续减少采样点;第二种,增加采样点。减少采样点会丢失更多细节,所以不推荐。
咱们来看看增加采样点的效果。
采样点=10000
几乎是还原了原貌,但是如果去除了低密度区域呢?
变得不完整了。所以看情况使用删点功能。
下面看看减少采样点的情况。
采样点=1000
跟预想中一样,虽然原来的那些散点没了,但同时也丢失了很多细节,得不偿失。
接下来换个模型看看重建效果。
采样点15000
接近极限了,即使是采样点基本包裹了整个模型,也依旧会丢失一些细节。
边栏推荐
- Get the uppercase initials of Chinese Pinyin in PHP
- Mmdetection model fine tuning
- What if the laptop task manager is gray and unavailable
- A slide with two tables will help you quickly understand the target detection
- Installation and use of image data crawling tool Image Downloader
- Implementation of purchase, sales and inventory system with ssm+mysql
- CONDA common commands
- Transform the tree structure into array in PHP (flatten the tree structure and keep the sorting of upper and lower levels)
- Translation of the paper "written mathematical expression recognition with bidirectionally trained transformer"
- 【MnasNet】《MnasNet:Platform-Aware Neural Architecture Search for Mobile》
猜你喜欢

How to clean up logs on notebook computers to improve the response speed of web pages

【AutoAugment】《AutoAugment:Learning Augmentation Policies from Data》

Memory model of program

Record of problems in the construction process of IOD and detectron2

图片数据爬取工具Image-Downloader的安装和使用

TimeCLR: A self-supervised contrastive learning framework for univariate time series representation
![[introduction to information retrieval] Chapter 6 term weight and vector space model](/img/42/bc54da40a878198118648291e2e762.png)
[introduction to information retrieval] Chapter 6 term weight and vector space model

Faster-ILOD、maskrcnn_ Benchmark trains its own VOC data set and problem summary

What if a new window always pops up when opening a folder on a laptop
![[introduction to information retrieval] Chapter II vocabulary dictionary and inverted record table](/img/3f/09f040baf11ccab82f0fc7cf1e1d20.png)
[introduction to information retrieval] Chapter II vocabulary dictionary and inverted record table
随机推荐
Interpretation of ernie1.0 and ernie2.0 papers
Deep learning classification Optimization Practice
【BiSeNet】《BiSeNet:Bilateral Segmentation Network for Real-time Semantic Segmentation》
Ppt skills
机器学习理论学习:感知机
Label propagation
Faster-ILOD、maskrcnn_ Benchmark training coco data set and problem summary
Typeerror in allenlp: object of type tensor is not JSON serializable error
Mmdetection installation problem
ModuleNotFoundError: No module named ‘pytest‘
What if the laptop task manager is gray and unavailable
【MEDICAL】Attend to Medical Ontologies: Content Selection for Clinical Abstractive Summarization
【TCDCN】《Facial landmark detection by deep multi-task learning》
【Cascade FPD】《Deep Convolutional Network Cascade for Facial Point Detection》
CONDA common commands
【MnasNet】《MnasNet:Platform-Aware Neural Architecture Search for Mobile》
【AutoAugment】《AutoAugment:Learning Augmentation Policies from Data》
PPT的技巧
传统目标检测笔记1__ Viola Jones
【多模态】CLIP模型








