Conditional euclidean clustering

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

Conditional euclidean clustering

roby23
Hello, 

I am trying to use Conditional Euclidean Clustering, but I have a linker error at compile time.

Error 1 error LNK2019: undefined reference to external symbol "public: void __cdecl pcl::ConditionalEuclideanClustering<struct pcl::PointXYZRGBNormal>::segment(class std::vector<struct pcl::PointIndices,class std::allocator<struct pcl::PointIndices> > &)" (?segment@?$ConditionalEuclideanClustering@UPointXYZRGBNormal@pcl@@@pcl@@QEAAXAEAV?$vector@UPointIndices@pcl@@V?$allocator@UPointIndices@pcl@@@std@@@std@@@Z)

Here is the code:

        PointCloud<PointXYZRGBNormal>::Ptr cloud_with_normals(new pcl::PointCloud<PointXYZRGBNormal>);

        ...
        ...
        ...

        pcl::IndicesClustersPtr clusters(new pcl::IndicesClusters);

pcl::ConditionalEuclideanClustering<pcl::PointXYZRGBNormal> cec(true);
cec.setInputCloud(cloud_with_normals);
cec.setConditionFunction(&customRegionGrowing);
cec.setClusterTolerance(200.0);
cec.segment(*clusters);


If I try with PointType pcl::PointXYZI everything is fine, but if I use a PointType with normals I get the error. 

Can you give me some help on this?

Many thanks

--
Roberto Battisti

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Conditional euclidean clustering

andyk
This post has NOT been accepted by the mailing list yet.
I just had exactly the same issue.

I resolved it by looking in the conditional_euclidean_clustering.h file, and changing the following, starting on line 249 :

//#ifdef PCL_NO_PRECOMPILE
#include <pcl/segmentation/impl/conditional_euclidean_clustering.hpp>
//#endif

(ie commenting out the ifdef statement, forcing the #include to run)

This forces all point types to be defined, presumably.

Its probably not the best way to fix this, but I'm no expert - it is a way though.

Andy
Reply | Threaded
Open this post in threaded view
|

Re: Conditional euclidean clustering

MarkL
This post has NOT been accepted by the mailing list yet.
In reply to this post by roby23
Another solution that doesn't involve making any changes to the PCL code, is to copy the input cloud to an intermediate cloud of type pcl::PointXYZ. As the segmentation result is given in the form of indices, it doesn't matter what type of cloud you perform the segmentation on.

So my suggestion is:

PointCloud<PointXYZRGBNormal>::Ptr cloud_with_normals(new pcl::PointCloud<PointXYZRGBNormal>);

        ...
        ...
        ...

pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_intermediate( new pcl::PointCloud<pcl::PointXYZ>);
pcl::copyPointCloud<pcl::PointXYZRGBNormal, pcl::PointXYZ>(*cloud, *cloud_intermediate);

pcl::IndicesClustersPtr clusters(new pcl::IndicesClusters);

pcl::ConditionalEuclideanClustering<pcl::PointXYZRGBNormal> cec(true);
cec.setInputCloud(cloud_intermediate);
...
cec.segment(*clusters);

The indices in clusters can now be used with the original cloud (cloud_with_normals).

roby23 wrote
Hello,

I am trying to use Conditional Euclidean Clustering, but I have a linker
error at compile time.

Error 1 error LNK2019: undefined reference to external symbol "public: void
__cdecl pcl::ConditionalEuclideanClustering<struct
pcl::PointXYZRGBNormal>::segment(class std::vector<struct
pcl::PointIndices,class std::allocator<struct pcl::PointIndices> > &)"
(?segment@?$ConditionalEuclideanClustering@UPointXYZRGBNormal@pcl@@@pcl@
@QEAAXAEAV?$vector@UPointIndices@pcl@@V?$allocator@UPointIndices@pcl@@@std@
@@std@@@Z)

Here is the code:

        ...


If I try with PointType pcl::PointXYZI everything is fine, but if I use a
PointType with normals I get the error.

Can you give me some help on this?

Many thanks

--
Roberto Battisti

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users