错误1
pcl::SACSegmentation<pcl::PCLPointCloud2>::segment(pcl::PointIndices&, pcl::ModelCoefficients&)’未定义的引用
在用sac_segmentation时,出现这个错误
感觉方案二可行,但我用后报错
no matching function for call to ‘pcl::SampleConsensusModelSphere<pcl::PCLP......
搜集一番资料感觉是头文件添加impl后,无法处理PCLPointcloud2格式。转换思路,将PCLPointcloud2格式转换为PointXYZI格式进行处理,主要代码如下:
pcl::PCLPointCloud2* cloud = new pcl::PCLPointCloud2;
pcl::PCLPointCloud2ConstPtr cloudPtr(cloud);
pcl::PCLPointCloud2 cloud1 ;
pcl::PCLPointCloud2 cloud_filtered;
// ros消息-->PCLPointCloud2
pcl_conversions::toPCL(*input, *cloud);
//PCLPointCloud2-->PointXYZI
pcl::PointCloud<pcl::PointXYZI>::Ptr temp_cloud(new pcl::PointCloud<pcl::PointXYZI>);
pcl::PointCloud<pcl::PointXYZI>::Ptr out(new pcl::PointCloud<pcl::PointXYZI>);
pcl::fromPCLPointCloud2(*cloud,*temp_cloud);
//PointXYZI-->PCLPointCloud2
pcl::toPCLPointCloud2(*out,cloud1);
//PCLPointCloud2-->ros消息
sensor_msgs::PointCloud2 output;
pcl_conversions::fromPCL(cloud1, output);