patchwork++复现————————地面点云分割复现

如有问题可以联系我v:15130883468

代码地址:大但你kdurl-kaist/patchwork-plusplus:Patchwork++:用于 3D LiDAR 扫描的快速而强大的地面分割方法。@ IROS'22 (github.com)

我使用的虚拟机复现的ubuntu 20.04,当然18.04也是可以的。

首先运行下边的命令

# Install prerequisite packages including Open3D
#克隆代码
$ git clone https://github.com/url-kaist/patchwork-plusplus
$ cd patchwork-plusplus
$ bash scripts/install_open3d.bash

但是

bash scripts/install_open3d.bash是自动下载指令往往会运行失败

这个是时候就需要手动下载

# To install Eigen and numpy
#注意numpy>=1.23.0
$ sudo apt-get install libeigen3-dev
$pip install numpy==1.23

# To install Open3D Python packages
$ pip install open3d

# To install Open3D C++ packages

$ git clone https://github.com/isl-org/Open3D
$ cd Open3D
$ util/install_deps_ubuntu.sh # Only needed for Ubuntu
$ mkdir build && cd build
$ cmake ..


#make指令会出现较多错误推荐使用sudo make  或者make -j4(or -j8)这个时候出现错误可以根据错误手动下载,可以参考我的另一篇文章很简单。

$make  # If it fails, try several times or try 'sudo make'



$ sudo make install

构建

在源代码文件下打开

 patchwork-plusplus
$ mkdir build && cd build
$ cmake ..
$ make

运行:

# Run patchwork++ and visualize ground points(green) and nonground points(red)
$ ./build/examples/cpp/demo_visualize

# Run patchwork++ with sequential point cloud inputs 
$ ./build/examples/cpp/demo_sequential

# Run patchwork++ with your point cloud file, example here
$ ./build/examples/cpp/demo_visualize ./data/000000.bin # specify file path

效果展示

这个现在只能使用c++构建

python构建总是显示 

ERROR: Could not build wheels for pypatchworkpp, which is required to install pyproject.toml-based projects
 

如果只是显示地面地面点云或者非地面点云可以更改

patchwork-plusplus/examples/cpp/demo_visualize.cpp文件的

  visualizer.AddGeometry(geo_ground);            //地面部分的点云显示
  visualizer.AddGeometry(geo_nonground);         //非地面部分点云显示



//-------------------注释完成后重新运行在patchwork-plusplus/build路径下打开命令窗口运行make指令

根据需要注释,注释完成后重新运行在patchwork-plusplus/build路径下打开命令窗口运行make指令。最后回到patchwork-plusplus路径。执行命令

cd patchwork-plusplus/build
make 

#返回上一级目录执行代码
cd ..            
./build/examples/cpp/demo_visualize ./data/000001.bin 

显示结果如下

### Patchwork 方法用于地面分割的实现和应用 #### 实现原理 Patchwork 是一种针对复杂环境下的高效地面分割方法。该方法首先将点云按照基于同心区域模型划分为多个子区域(bins),并确保各 bin 间合理分配点云数据[^1]。随后,对每个 bin 进行局部的地平面拟合,从而得到部分地面估计。为了提高精度,引入了地面似然估计机制来显著降低误判率。 ```python def patchwork_ground_segmentation(point_cloud_data, bins=8): """ 使用 Patchwork 方法进行地面分割 参数: point_cloud_data (list of tuples): 输入点云数据 [(x,y,z), ...] bins (int): 同心圆分区数量 返回: ground_points (list of tuples): 分割后的地面点集合 non_ground_points (list of tuples): 非地面点集合 """ # Step 1: 基于同心圆形区域划分点云 divided_bins = divide_point_cloud_into_concentric_zones(point_cloud_data, bins) # Step 2: 对每个 bin 执行地平面拟合 partial_grounds = [] for zone in divided_bins: fitted_plane = fit_local_ground_plane(zone) partial_grounds.append(fitted_plane) # Step 3: 计算地面可能性得分 likelihood_scores = compute_likelihood_of_being_ground(partial_grounds) # Step 4: 综合判断最终地面点 ground_points, non_ground_points = classify_points_based_on_likelihood(likelihood_scores) return ground_points, non_ground_points ``` 此 Python 函数展示了如何利用 Patchwork 技术处理三维点云数据以区分地面与非地面特征。具体来说: - **Step 1**: 将原始点云依据距离远近分成若干个环形带状区域; - **Step 2**: 在每一个区域内单独计算最佳匹配的地平面方程; - **Step 3**: 利用地面概率评估函数给定每一点属于地面的可能性分数; - **Step 4**: 根据设定阈值筛选出真正的地面点群组和其他对象。 #### 应用场景 Patchwork 不仅适用于平坦开阔地带,而且能够有效应对诸如斜坡、坑洼等地形变化以及路边设施带来的挑战。实验证明,在 SemanticKITTI 数据集以及其他崎岖环境中均表现出优异性能,尤其适合安装有多种规格 LiDAR 设备的自动驾驶车辆或服务型机器人平台使用[^4]。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值