data structure in PCL

show you some code here first:

</pre><pre name="code" class="cpp">

void PointXYZRGBAtoXYZI (pcl::PointXYZRGBA& in, pcl::PointXYZI& out)
{
	out.x = in.x; out.y = in.y; out.z = in.z;
	out.intensity = 0.299f * static_cast <float> (in.r) + 0.587f * static_cast <float> (in.g) + 0.114f * static_cast <float> (in.b);
}




void PointCloudXYZRGBtoXYZI (pcl::PointCloud<pcl::PointXYZRGBA>& in,pcl::PointCloud<pcl::PointXYZI>& out)
{
	out.width   = in.width;
	out.height  = in.height;
	for (size_t i = 0; i < in.points.size (); i++)
	{
		pcl::PointXYZI p;
		PointXYZRGBAtoXYZI (in.points[i], p);
		out.points.push_back (p);
	}
}
you can see the two functions defined, that's to say:

1.pcl::PointCloud is just like a vector structure, different types of points can be stored in the pcl::PointCloud

So, in the definition pcl::PointCloud<pcl::PointXYZRGBA>& in,   "in" 

2.pcl::PointXYZRGBA is the concrete point type, so in the definition pcl::PointXYZRGBA& in , here in has the feature of what PointXYZRGBA has

3. through the functions I have written above, you may known more about the PCL data structure


more than that, let's say something about how to get access to the functions above

	pcl::PointCloud<PointTRGBA>::Ptr cloud (new pcl::PointCloud<PointTRGBA>);
	pcl::PointCloud<PointT>::Ptr cloudXYZI (new pcl::PointCloud<PointT>);
	PointCloudXYZRGBtoXYZI(*cloud,*cloudXYZI);
so, if you define you input and output as Ptr, you may change them into *xxx, in order to call the function.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值