Open3d Point cloud outlier removal 点云异常值移除

简介: Open3d Point cloud outlier removal 点云异常值移除

Point cloud outlier removal 点云异常值移除

从扫描设备收集数据时,生成的点云往往包含想要删除的噪声和伪影(artifacts)。本教程介绍了 Open3D 的异常值删除功能。

Prepare input data 准备输入数据

加载点云,使用voxel_downsample下采样。

print("Load a ply point cloud, print it, and render it")
sample_pcd_data = o3d.data.PCDPointCloud()
pcd = o3d.io.read_point_cloud(sample_pcd_data.path)
o3d.visualization.draw_geometries([pcd],
                                  zoom=0.3412,
                                  front=[0.4257, -0.2125, -0.8795],
                                  lookat=[2.6172, 2.0475, 1.532],
                                  up=[-0.0694, -0.9768, 0.2024])

print("Downsample the point cloud with a voxel of 0.02")
voxel_down_pcd = pcd.voxel_down_sample(voxel_size=0.02)
o3d.visualization.draw_geometries([voxel_down_pcd],
                                  zoom=0.3412,
                                  front=[0.4257, -0.2125, -0.8795],
                                  lookat=[2.6172, 2.0475, 1.532],
                                  up=[-0.0694, -0.9768, 0.2024])

或者使用uniform_down_sample 点云下采样,通过收集每n个点。

print("Every 5th points are selected")
uni_down_pcd = pcd.uniform_down_sample(every_k_points=5)
o3d.visualization.draw_geometries([uni_down_pcd],
                                  zoom=0.3412,
                                  front=[0.4257, -0.2125, -0.8795],
                                  lookat=[2.6172, 2.0475, 1.532],
                                  up=[-0.0694, -0.9768, 0.2024])

Select down sample 选择下采样

下面函数使用select_by_index ,它采用二进制掩码(binary mash)来仅输出选定的点。所选点和未所选点将可视化。

def display_inlier_outlier(cloud, ind):
    inlier_cloud = cloud.select_by_index(ind)
    outlier_cloud = cloud.select_by_index(ind, invert=True)

    print("Showing outliers (red) and inliers (gray): ")
    outlier_cloud.paint_uniform_color([1, 0, 0])
    inlier_cloud.paint_uniform_color([0.8, 0.8, 0.8])
    o3d.visualization.draw_geometries([inlier_cloud, outlier_cloud],
                                      zoom=0.3412,
                                      front=[0.4257, -0.2125, -0.8795],
                                      lookat=[2.6172, 2.0475, 1.532],
                                      up=[-0.0694, -0.9768, 0.2024])

Statistical outlier removal 统计异常值删除

statistical_outlier_removal删除与平均值相比,与其相邻点距离过大的点。它需要两个输入参数:

nb_neighbors,它指定在计算给定点的平均距离时要考虑的相邻要素数。

std_ratio,允许根据点云中平均距离的标准偏差设置阈值水平。此数字越低,过滤器的激进程度就越高,删除的越多。

print("Statistical oulier removal")
cl, ind = voxel_down_pcd.remove_statistical_outlier(nb_neighbors=20,
                                                    std_ratio=2.0)
display_inlier_outlier(voxel_down_pcd, ind)

Radius outlier removal 半径异常值删除

radius_outlier_removal移除在给定球体周围具有较少邻居的点。可以使用两个参数来调整筛选器以显示您的数据:

nb_points,允许您选取球体应包含的最小点数。

radius,它定义将用于计算相邻要素的球体的半径。

print("Radius oulier removal")
cl, ind = voxel_down_pcd.remove_radius_outlier(nb_points=16, radius=0.05)
display_inlier_outlier(voxel_down_pcd, ind)


相关文章
|
1月前
GEE错误——Layer error: Image.connectedPixelCount: Segment size calculation on floating point bands is n
GEE错误——Layer error: Image.connectedPixelCount: Segment size calculation on floating point bands is n
42 0
|
1月前
|
机器学习/深度学习 编解码 算法
图像超分:RFB-ESRGAN(Perceptual Extreme Super Resolution Network with Receptive Field Block)
图像超分:RFB-ESRGAN(Perceptual Extreme Super Resolution Network with Receptive Field Block)
82 0
HALCON error #1302: Wrong value of control parameter: 2 in operator affine_trans_region
HALCON error #1302: Wrong value of control parameter: 2 in operator affine_trans_region
|
2天前
|
并行计算 监控 Java
函数计算操作报错合集之遇到报错:RuntimeError: Expected all tensors to be on the same device,是什么原因
在使用函数计算服务(如阿里云函数计算)时,用户可能会遇到多种错误场景。以下是一些常见的操作报错及其可能的原因和解决方法,包括但不限于:1. 函数部署失败、2. 函数执行超时、3. 资源不足错误、4. 权限与访问错误、5. 依赖问题、6. 网络配置错误、7. 触发器配置错误、8. 日志与监控问题。
|
15天前
|
JSON 算法 数据可视化
Open3d-Point cloud (点云)
Open3d-Point cloud (点云)
|
1月前
|
Python
GEE—关于RSEI生态遥感指数中出现的问题 Layer error: Image.rename: The number of names (1) must match the number of..
GEE—关于RSEI生态遥感指数中出现的问题 Layer error: Image.rename: The number of names (1) must match the number of..
62 0
|
1月前
QGIS【实例 01】筛选范围内的数据相交intersection工具使用及Feature (347897) has invalid geometry问题处理
QGIS【实例 01】筛选范围内的数据相交intersection工具使用及Feature (347897) has invalid geometry问题处理
123 0
|
8月前
paraformer支持设置 speech_noise_threshold 这个参数吗 ?
请问:speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch 这个模型支持设置 speech_noise_threshold 这个参数吗 ? vad 本身是支持的,但对这个集成的模型好像不起作用? 如果支持,应该如何正确地设置呢 ? 如果不支持,那该模型有没有什么方法可以过滤掉背景噪声? 经常会有背景噪声被识别出文字
40 0
|
8月前
|
XML 安全 数据安全/隐私保护
SAP Success Factor Single Sign On(单点集成) 的文档清单
SAP Success Factor Single Sign On(单点集成) 的文档清单
ArcSWAT报错:数据集未投影;Dataset must have a projected coordinate system
ArcSWAT报错:数据集未投影;Dataset must have a projected coordinate system