Cloud processing (basic) - Conditional removal
Posted 千里之行始于足下
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cloud processing (basic) - Conditional removal相关的知识,希望对你有一定的参考价值。
Conditional removal
Another way of getting the exact same result than with the previous example would be to use a conditional removal filter. We can build any kind of condition we want for the values of the point:
#include <pcl/io/pcd_io.h> #include <pcl/filters/conditional_removal.h> int main(int argc, char** argv) { // Objects for storing the point clouds. pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); pcl::PointCloud<pcl::PointXYZ>::Ptr filteredCloud(new pcl::PointCloud<pcl::PointXYZ>); // Read a PCD file from disk. if (pcl::io::loadPCDFile<pcl::PointXYZ>(argv[1], *cloud) != 0) { return -1; } // We must build a condition. // And "And" condition requires all tests to check true. "Or" conditions also available. pcl::ConditionAnd<pcl::PointXYZ>::Ptr condition(new pcl::ConditionAnd<pcl::PointXYZ>); // First test, the point‘s Z value must be greater than (GT) 0. condition->addComparison(pcl::FieldComparison<pcl::PointXYZ>::ConstPtr(new pcl::FieldComparison<pcl::PointXYZ>("z", pcl::ComparisonOps::GT, 0.0))); // Second test, the point‘s Z value must be less than (LT) 2. condition->addComparison(pcl::FieldComparison<pcl::PointXYZ>::ConstPtr(new pcl::FieldComparison<pcl::PointXYZ>("z", pcl::ComparisonOps::LT, 2.0))); // Checks available: GT, GE, LT, LE, EQ. // Filter object. pcl::ConditionalRemoval<pcl::PointXYZ> filter; filter.setCondition(condition); filter.setInputCloud(cloud); // If true, points that do not pass the filter will be set to a certain value (default NaN). // If false, they will be just removed, but that could break the structure of the cloud // (organized clouds are clouds taken from camera-like sensors that return a matrix-like image). filter.setKeepOrganized(true); // If keep organized was set true, points that failed the test will have their Z value set to this. filter.setUserFilterValue(0.0); filter.filter(*filteredCloud); }
- Input: Points, Condition, [Keep organized]
- Output: Filtered points
- Tutorial: Removing outliers using a Conditional or RadiusOutlier removal
- API: pcl::ConditionalRemoval
以上是关于Cloud processing (basic) - Conditional removal的主要内容,如果未能解决你的问题,请参考以下文章
Unix Basics & Thread v.s. Process & Parentheses 问题专题
Spring Security 配置:Basic Auth + Spring Cloud Gateway