Reputation: 175
I am trying to load and visualize a point cloud data by "addPointCloud" instruction.
//***********
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBA>);
if (pcl::io::loadPCDFile<pcl::PointXYZRGBA> ("f.pcd", *cloud) == -1)
{
PCL_ERROR ("Couldn't read the pcd file \n");
return (-1);
}
pcl::visualization::PCLVisualizer viewer ("Simple Cloud Viewer");
viewer.setBackgroundColor (0, 0, 0);
viewer.addPointCloud(cloud, "sample cloud");
//***********
But instead of seeing my point cloud in a black background, only see a white backbround whithout any point cloud. Can any one tell me kindly where is my problem?
Upvotes: 1
Views: 1197
Reputation: 725
pcl::visualization::PCLVisualizer viewer
window object has been created and you're currently looking at just the window... You would need to add .spin()
viewer.spin();
Upvotes: 0
Reputation: 11
add the following to your code
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGB>);
// do stuff
pcl::visualization::PointCloudColorHandlerRGB<pcl::PointXYZRGB> rgb(cloud);
viewer.addPointCloud <pcl:PointXYZRGB> (cloud,rgb,"cloud1");
Depending on the viewpoint you have to zoom out.
Hope this helps
Upvotes: 1