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.