The most common way to do this is by subscript in the [] operand[1]
pcl::PointCloud<pcl::PointXYZ>::Ptr pointCloud;
for(int nIndex = 0; nIndex < pointCloud->points.size (); nIndex++)
{
pointCloud->points[nIndex].x;
pointCloud->points[nIndex].y;
pointCloud->points[nIndex].z;
}
The more efficient way is to use an iterator [2] [3]
The example in Euclidean Cluster Extraction of pcl tutorials is well known [2].
Extract the indices cluster_indices
then use it to iterate each pointcloud from cluster_indices.begin ()
to cluster_indices.end ()
. Next step is to iterate every point in the pointcloud from it->indices.begin ();
to it->indices.end ()
. The code snippet is:
std::vector<pcl::PointIndices> cluster_indices;
pcl::EuclideanClusterExtract