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);
}

null

时间: 2024-08-06 07:54:58

Cloud processing (basic) - Conditional removal的相关文章

学习Spring Cloud中eureka注册中心添加security认证,eureka client注册启动报错

最近使用SpringCloud在eureka server端添加security登录认证之后,eureka client注册启动一直报错,大概意思是未发现eureka server,导致注册启动失败! 1 2018-08-09 14:50:06.042 WARN 13256 --- [nfoReplicator-0] c.n.discovery.InstanceInfoReplicator : There was a problem with the instance info replicat

总结一些机器视觉库

通用库/General Library OpenCV   无需多言. RAVL  Recognition And Vision Library. 线程安全.强大的IO机制.包含AAM. CImg  很酷的一个图像处理包.整个库只有一个头文件.包含一个基于PDE的光流算法. 图像,视频IO/Image, Video IO FreeImage DevIL ImageMagick FFMPEG VideoInput portVideo AR相关/Augmented Reality ARToolKit 

转载:2013计算机视觉代码合集

转载,原文地址http://blog.csdn.net/daoqinglin/article/details/23607079 -------------------------------------------------------------------------- 来源: http://www.yuanyong.org/cv/cv-code-one.html http://www.yuanyong.org/cv/cv-code-two.html http://www.yuanyong

【干货】国外程序员整理的 C++ 资源大全【转】

来自 https://github.com/fffaraz/awesome-cpp A curated list of awesome C/C++ frameworks, libraries, resources, and shiny things. Inspired by awesome-... stuff Standard Libraries C++ Standard Library - including STL Containers, STL Aglorithm, STL Functio

机器视觉开源代码集合

来源:http://xilinx.eetrend.com/article/8919 一.特征提取Feature Extraction: SIFT [1] [Demo program][SIFT Library] [VLFeat] PCA-SIFT [2] [Project] Affine-SIFT [3] [Project] SURF [4] [OpenSURF] [Matlab Wrapper] Affine Covariant Features [5] [Oxford project] MS

[转]机器视觉开源代码集合

一.特征提取Feature Extraction: l  SIFT [1] [Demo program][SIFT Library] [VLFeat] l  PCA-SIFT [2] [Project] l  Affine-SIFT [3] [Project] l  SURF [4] [OpenSURF] [Matlab Wrapper] l  Affine Covariant Features [5] [Oxford project] l  MSER [6] [Oxford project]

计算机视觉牛人博客和代码汇总

每个做过或者正在做研究工作的人都会关注一些自己认为有价值的.活跃的研究组和个人的主页,关注他们的主页有时候比盲目的去搜索一些论文有用多了,大牛的或者活跃的研究者主页往往提供了他们的最新研究线索,顺便还可八一下各位大牛的经历,对于我这样的小菜鸟来说最最实惠的是有时可以找到源码,很多时候光看论文是理不清思路的. 1 牛人Homepages(随意排序,不分先后): 1.USC Computer Vision Group:南加大,多目标跟踪/检测等: 2.ETHZ Computer Vision Lab

计算机视觉牛人博客和代码汇总(全)

每个做过或者正在做研究工作的人都会关注一些自己认为有价值的.活跃的研究组和个人的主页,关注他们的主页有时候比盲目的去搜索一些论文有用多了,大牛的或者活跃的研究者主页往往提供了他们的最新研究线索,顺便还可八一下各位大牛的经历,对于我这样的小菜鸟来说最最实惠的是有时可以找到源码,很多时候光看论文是理不清思路的. 1 牛人Homepages(随意排序,不分先后): 1.USC Computer Vision Group:南加大,多目标跟踪/检测等: 2.ETHZ Computer Vision Lab

Google C++ 代码规范

Google C++ Style Guide Table of Contents Header Files Self-contained Headers The #define Guard Forward Declarations Inline Functions Names and Order of Includes Scoping Namespaces Unnamed Namespaces and Static Variables Nonmember, Static Member, and