Open3D mesh 均值滤波

2022-07-26,,,

版权声明:本博客由CSDN点云侠书写,网址为:https://editor.csdn.net/md?not_checkout=1&articleId=110421201其它平台均为盗版抄袭!!!

一、函数解析

Open3d包含许多网格滤波的算法,最简单的是均值滤波。一个顶点

v

i

v_i

vi的值是通过相邻顶点的平均值给出的。公式如下:
                 

v

i

=

v

i

+

n

=

1

N

V

n

N

+

1

v_i=\frac{v_i+\sum_{n=1}^{N} V_n}{|N|+1}

vi=N+1vi+n=1NVn
如下面代码所示,该滤波器能用以网格去噪。filter_smooth_simple函数的参数number_of_iterations用来定义应用于网格的滤波器的频率。

二、完整代码

import open3d as o3d
import numpy as np

class o3dtut:
    def get_knot_mesh():
        mesh = o3d.io.read_triangle_mesh("knot.ply")
        mesh.compute_vertex_normals()
        return mesh

mesh_in = o3dtut.get_knot_mesh()
vertices = np.asarray(mesh_in.vertices)
noise = 5
vertices += np.random.uniform(0, noise, size=vertices.shape)
mesh_in.vertices = o3d.utility.Vector3dVector(vertices)
mesh_in.compute_vertex_normals()
o3d.visualization.draw_geometries([mesh_in],width=800,height=800)

print('filter with average with 1 iteration')
mesh_out = mesh_in.filter_smooth_simple(number_of_iterations=1)
mesh_out.compute_vertex_normals()
o3d.visualization.draw_geometries([mesh_out],width=800,height=800)

print('filter with average with 5 iterations')
mesh_out = mesh_in.filter_smooth_simple(number_of_iterations=5)
mesh_out.compute_vertex_normals()
o3d.visualization.draw_geometries([mesh_out],width=800,height=800)

三、结果展示

一次滤波迭代之后

五次迭代后

本文地址:https://blog.csdn.net/qq_36686437/article/details/110421201

《Open3D mesh 均值滤波.doc》

下载本文的Word格式文档,以方便收藏与打印。