VTK : cluster a point cloud and get points of each cluster

22 Views Asked by At

I'am trying to cluster a point cloud with vtkEuclideanClusterExtraction, like that:

vtkSmartPointer<vtkPolyData> cloudPolyData = vtkSmartPointer < vtkPolyData>::New();
cloudPolyData->SetPoints(_PointCloudInput);
vtkNew<vtkEuclideanClusterExtraction> cluster;
cluster->SetInputData(cloudPolyData);
cluster->SetExtractionModeToAllClusters();
cluster->SetRadius(100);
cluster->Update();

where _PointCloudInput is a vtkSmartPointer<vtkPoints>

When I did cluster->GetNumberOfExtractedClusters(), I got 104, so I guess it worked well.

Now, I'd like to know which point belongs to which cluster to create a list of vtkPoints for each cluster, so 104 lists. How could I do that ?

I tried with cluster->GetOutput()->GetPoints(); but I got all my cloud.

0

There are 0 best solutions below