Gaston
Gaston

Reputation: 225

PCL: use Euclidean Cluster Extraction with labeled points makes a LNK error

I have a point cloud that contains labeled points, thus it is a pcl::PointCloud<pcl::PointXYZL>.

I strictly followed what is said in this tutorial

I need these labels, and I need to extract clusters from the point cloud. But when I call the ECE with the labels I get an LNK error. But it does extract the clusters if I do it without labels:

#include <pcl/segmentation/extract_polygonal_prism_data.h>

#include <pcl/segmentation/extract_clusters.h>

#include <vector>
#include <memory>
#include <pcl/io/ply_io.h>

pcl::PointCloud<pcl::PointXYZL>::Ptr hello(new pcl::PointCloud<pcl::PointXYZL>);
pcl::PLYReader Reader5;
Reader5.read("sidewalk.ply", *hello);


std::shared_ptr<std::vector<pcl::PointCloud<pcl::PointXYZL>>> clusters = std::make_shared < std::vector<pcl::PointCloud<pcl::PointXYZL>>>();

pcl::search::KdTree<pcl::PointXYZL>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZL>);
tree->setInputCloud(hello);


std::vector<pcl::PointIndices> cluster_indices;
pcl::EuclideanClusterExtraction<pcl::PointXYZL> ec;
ec.setClusterTolerance(2.0);
ec.setMinClusterSize(100);
ec.setMaxClusterSize(25000);
ec.setSearchMethod(tree);
ec.setInputCloud(hello);
ec.extract(cluster_indices);

here is the error :

LNK2019 unresolved external symbol "public: void __cdecl pcl::EuclideanClusterExtraction<struct pcl::PointXYZL>::extract(class std::vector<struct pcl::PointIndices,class std::allocator<struct pcl::PointIndices> > &)" (?extract@?$EuclideanClusterExtraction@UPointXYZL@pcl@@@pcl@@QEAAXAEAV?$vector@UPointIndices@pcl@@V?$allocator@UPointIndices@pcl@@@std@@@std@@@Z) referenced in function main  pclProgramme

Do I have to create a new point cloud without labels to continue ?

Upvotes: 0

Views: 841

Answers (1)

Lars
Lars

Reputation: 51

I think you need to use LabeledEuclideanClusterExtraction, see: https://github.com/PointCloudLibrary/pcl/blob/master/segmentation/include/pcl/segmentation/extract_labeled_clusters.h

This is instantiated for the types with labels and therefore won't give linking errors with point type that has labels.

Upvotes: 1

Related Questions