资源简介
主要用于三维点云的平板分割, 每次只能分割出一个平面。
(It is mainly used for 3D point cloud segmentation.Only one plane can be segmented at a time.)

代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#include
int main(int argc char** argv)
{
pcl::PointCloud::Ptr cloud_source (new pcl::PointCloud);
pcl::PointCloud::Ptr cloud_target (new pcl::PointCloud);
// check arguments
if(argc != 2) {
std::cout << “ERROR: the number of arguments is illegal!“ << std::endl;
return -1;
}
// load pcd file
if(pcl::io::loadPCDFile(argv[1] *cloud_source)==-1) {
std::cout << “load source failed!“ << std::endl;
return -1;
}
std::cout << “source loaded!“ << std::endl;
// pass through filter to get the certain field
pcl::PointCloud::Ptr cloud_source_filtered(new pcl::PointCloud);
pcl::PassThrough pt;
pt.setInputCloud(cloud_source);
pt.setFilterFieldName(“y“);
pt.setFilterLimits(-0.1 0.6);
pt.filter(*cloud_source_filtered);
// segmentation
pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients);
pcl::PointIndices::Ptr inliers (new pcl::PointIndices);
pcl::SACSegmentation sac;
sac.setInputCloud(cloud_source_filtered); // cloud_source_filtered 为提取桌子表面 cloud_source 为提取地面
sac.setMethodType(pcl::SAC_RANSAC);
sac.setModelType(pcl::SACMODEL_PLANE);
sac.setDistanceThreshold(0.01);
sac.setMaxIterations(100);
sac.setProbability(0.95);
sac.segment(*inliers *coefficients);
// extract the certain field
pcl::ExtractIndices ei;
ei.setIndices(inliers);
ei.setInputCloud(cloud_source_filtered); // cloud_source_filtered 为提取桌子表面 cloud_source 为提取地面
ei.filter(*cloud_target);
std::cout << *coefficients << std::endl;
// display
pcl::visualization::PCLVisualizer p;
pcl::visualization::PointCloudColorHandlerCustom tgt_h (cloud_target 255 0 0);
p.addPointCloud(cloud_target tgt_h “target“);
p.spinOnce();
pcl::visualization::PCLVisualizer p2;
pcl::visualization::PointCloudColorHandlerCustom src_h (cloud_source 0 255 0);
p2.addPointCloud(cloud_source src_h “source“);
p2.spin();
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2349 2014-09-07 11:35 PlaneModelSegmentation.cpp
文件 17492958 2014-07-17 20:32 test.pcd
文件 358 2014-09-06 10:23 CMakeLists.txt
- 上一篇:漂亮高档的一栋别墅模型
- 下一篇:数字信号处理时分复用课程设计报告
相关资源
- 一种机载LiDAR和车载LiDAR点云的自动配
- SfM稀疏三维点云重建--完整工程文件
- 全面的点云库PCL学习教程
- 彩色图片和深度图片生成点云文件
- ICP+NDT点云配准
- 1种新的散乱点云快速去噪算法
- 点云库PCL学习教程 完整版
- .las格式点云文件
- icp三维点云配准文件
- 地形点云.pcd
-
openla
yers加载本地切片、高亮显示 - openGL实现三维点云显示
- GA+ICP代码
- 建筑物的地面扫描点云数据
- 点云拼接和拟合算法
- 点云TXT转换PCD
- PCL点云库SACSegmentation用法demo
- 小兔子pcd点云数据pcl官方案例1)
- 八叉树点云精简
- fandisk点云数据,asc文件数据,三维模
- 斯坦福数据集六个txt格式点云文件.
- 点云试验数据
- Generalized-ICP 论文
- 点云测量数据处理
-
fast desc
riptors点云粗配准配准论文, - 点云数据读取 使用osg 附带点云数据
- osg显示点云
- 利用PCL,OpenCV求取点云的体积
- Arcgis在线地图插件MapOnline v1.2
- Cyclone快速入门中文版
评论
共有 条评论