Writing a loadCloud subfunction

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

Writing a loadCloud subfunction

Wyllich
Hello,

I wanted o write simply a function which would load a cloud and return a pointer to it.
However, I'm facing a problem I do no know the solution of, when I use KFLANN to generate the kdtree.

Here's the code:

pcl::PointCloud<pcl::PointXYZ>::Ptr loadCloud(char* cloudfile)
{
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZL>);
    if(pcl::io::loadPCDFile<pcl::PointXYZ>(cloudfile, *cloud)==-1)
    {
        PCL_ERROR ("Error while reading file. \n");
    }
    return cloud;
}

Then, in another function, I would have:

  pcl::PointCloud<pcl::PointXYZL>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZL>);
  cloud = loadCloud(cloudfile);
 
  pcl::KdTreeFLANN<pcl::PointXYZ> kdtree;
  kdtree.setInputCloud(cloud);

...

thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Writing a loadCloud subfunction

vs-tec
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Writing a loadCloud subfunction

Wyllich
Thanks for the help.

It is working now. I should be more careful.