Visualizing Clusters

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Visualizing Clusters

pranavb104
Hello,

I'm trying to extract and visualize each individual cluster from my segmeted
point cloud.
The three clusters are being detected well and the number of points are also
being printed. But when I try to visualize cloud_cluster via a viewer, it
does not show anything. How do I visualize and output each individual point
cloud?

int j = 0;
                for (std::vector<pcl::PointIndices>::const_iterator it =
cluster_indices.begin(); it != cluster_indices.end(); ++it)
                {
                        pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_cluster(new
pcl::PointCloud<pcl::PointXYZ>);
                        for (std::vector<int>::const_iterator pit = it->indices.begin(); pit !=
it->indices.end(); ++pit)
                                cloud_cluster->points.push_back(cloud_j->points[*pit]);
                        cloud_cluster->width = static_cast<uint32_t>
(cloud_cluster->points.size());
                        cloud_cluster->height = 1;
                        cloud_cluster->is_dense = true;


                        std::cout << "PointCloud representing the Cluster: " <<
cloud_cluster->points.size() << " data points." << std::endl;
                       
                }


                       



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Visualizing Clusters

Richard Frank
Take a look at the SimpleONIViewer 



that said, I find that I have to use the thumb wheel on the mouse to get the point clouds within the camera view frustum....it needs the equivalent of vtkResetCamera...

Rick Frank

On Jan 23, 2018, at 6:27 PM, pranavb104 <[hidden email]> wrote:

Hello,

I'm trying to extract and visualize each individual cluster from my segmeted
point cloud.
The three clusters are being detected well and the number of points are also
being printed. But when I try to visualize cloud_cluster via a viewer, it
does not show anything. How do I visualize and output each individual point
cloud?

int j = 0;
       for (std::vector<pcl::PointIndices>::const_iterator it =
cluster_indices.begin(); it != cluster_indices.end(); ++it)
       {
           pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_cluster(new
pcl::PointCloud<pcl::PointXYZ>);
           for (std::vector<int>::const_iterator pit = it->indices.begin(); pit !=
it->indices.end(); ++pit)
               cloud_cluster->points.push_back(cloud_j->points[*pit]);
           cloud_cluster->width = static_cast<uint32_t>
(cloud_cluster->points.size());
           cloud_cluster->height = 1;
           cloud_cluster->is_dense = true;


           std::cout << "PointCloud representing the Cluster: " <<
cloud_cluster->points.size() << " data points." << std::endl;
           
       }


           



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Visualizing Clusters

pranavb104
This post was updated on .
I did not get your advise.

I basically want to use viewer->addpointcloud to visualize my individual
clusters.

In the code above, cloud_cluster collects all the individual clusters. Simply doing
viewer->addPointCloud(cloud_cluster, "cloud_cluster"); does not work!! My
questions is how do I visualize these individial point clouds ?



--
Sent from: http://www.pcl-users.org/
_______________________________________________
PCL-users@pointclouds.org / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Visualizing Clusters

denix56
Use PclVisualizer and add all 3 pointclouds in it. Also you could convert your points to PointXYZRGB or use color handler to color each cluster in unique color.

2018-01-24 15:19 GMT+02:00 pranavb104 <[hidden email]>:
I did not get your advise.

I basically want to use viewer->addpointcloud to visualize my individual
clusters.

In the code above, cloud_cluster collects all the individual clusters. My
questions is how do I visualize these individial point clouds ?


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users