通过地面拟合去除地面

# coding:utf-8

import open3d as o3d
import numpy as np
import copy


def pcd_ground_seg_open3d(scan, config):
  """ Open3D also supports segmententation of geometric primitives from point clouds using RANSAC.
  """
  pcd = copy.deepcopy(scan)

  ground_model, ground_indexes = scan.segment_plane(distance_threshold=0.3,
                                                    ransac_n=3,
                                                    num_iterations=100)
  ground_indexes = np.array(ground_indexes)

  ground = pcd.select_by_index(ground_indexes)
  rest = pcd.select_by_index(ground_indexes, invert=True)

  ground.paint_uniform_color(config['ground_color'])
  rest.paint_uniform_color(config['rest_color'])

  return ground, rest

版权声明:本文为a394467238原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/a394467238/article/details/128080826