我是靠谱客的博主 热情棉花糖,这篇文章主要介绍PassThrough直通滤波实现,现在分享给大家,希望可以做个参考。

原理:对指定的某一维度进行滤波,去掉用户指定字段范围内(或外)的点。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
void passthrough(pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud, pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_filtered, std::string field_name, float limit_min, float limit_max, bool limit_negative = false) { vector<int> index; for (size_t i = 0; i < cloud->points.size(); ++i) { if (field_name == "x") { if (cloud->points[i].x >= limit_min && cloud->points[i].x <= limit_max) index.push_back(i); } if (field_name == "y") { if (cloud->points[i].y >= limit_min && cloud->points[i].y <= limit_max) index.push_back(i); } if (field_name == "z") { if (cloud->points[i].z >= limit_min && cloud->points[i].z <= limit_max) index.push_back(i); } } boost::shared_ptr<std::vector<int>> index_ptr = boost::make_shared<std::vector<int>>(index); pcl::ExtractIndices<pcl::PointXYZ> extract; extract.setInputCloud(cloud); extract.setIndices(index_ptr); extract.setNegative(limit_negative); extract.filter(*cloud_filtered); }

最后

以上就是热情棉花糖最近收集整理的关于PassThrough直通滤波实现的全部内容,更多相关PassThrough直通滤波实现内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(100)

评论列表共有 0 条评论

立即
投稿
返回
顶部