Load and visualize PCD file having XYZRGBAL points

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Load and visualize PCD file having XYZRGBAL points

This post has NOT been accepted by the mailing list yet.
Hey guys,

I'm currently struggling to load and visualize some pcd files (from the Jacobs University Dataset, see link below). It is actually working, but the displayed cloud looks weird, the geometry seems to be OK, but the colors are totally diffused. I initially tried to load the pcd file as PointXYZRGBL as proposed by the others, but this gives me the below shown weird results.  I also tried only with PointXYZRGB, tried even parsing the whole file on my own and then insert each point as XYZRGB separately into the cloud, but all of that yield to having the same results, now I am really thinking if the files might be bad.


I am using the PCL Version 1.7.2.

Here is what I tried out so far:
    if (pcl::io::loadPCDFile<pcl::PointXYZRGBL> (cloudFilePath, *lCloudPtr) == -1) //* load the file
        PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
        return false;

    // Visualization as proposed by docs of pcl
    boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
    viewer->setBackgroundColor (0, 0, 0);
    pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGBL> rgb(lCloudPtr);
    viewer->addPointCloud<pcl::PointXYZRGBL>(lCloudPtr, rgb, "sample cloud");
    viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "sample cloud");
    //viewer->addCoordinateSystem (1.0);
    viewer->initCameraParameters ();

    while (!viewer->wasStopped ())
        viewer->spinOnce (100);
        boost::this_thread::sleep (boost::posix_time::microseconds (100000));

Here is an image of the resulting visualization of the point cloud obtained from loading the pcd file with any of the before mentioned point types.

Would be great, if someone could point out what I am doing wrong or test to load+visualize the pcd files on his/her own system. This strange behaviour occurs to me for each of the provided pcd files.

Thank you very much all.