open3d-点云离群点筛查

import open3d as o3d
import numpy as np
from open3d.web_visualizer import draw
from open3d.visualization import draw_geometries

1. 读取点云,并下采样

pcd = o3d.io.read_point_cloud("datas/fragment.ply")
draw(pcd)
pcd_vox_down = pcd.voxel_down_sample(0.03)
draw(pcd_vox_down)

2. 离群点筛查

open3d为PointCloud提供了两种筛查方式:

  • def remove_statistical_outlier(self, nb_neighbors, std_ratio):
  • def remove_radius_outlier(self, nb_points, radius):
kp_pcd, ind = pcd_vox_down.remove_statistical_outlier(nb_neighbors=20, std_ratio=1.0)

rm_pcd = pcd_vox_down.select_by_index(ind, True)

rm_pcd.paint_uniform_color([1,0,0])
draw([kp_pcd, rm_pcd])
kp_pcd, ind = pcd_vox_down.remove_radius_outlier(nb_points=5, radius=0.05)

rm_pcd = pcd_vox_down.select_by_index(ind, True)

rm_pcd.paint_uniform_color([1,0,0])
draw([kp_pcd, rm_pcd])