diff --git a/LidarCore/Filters/Processing/vtkAdaptiveOutlierRemoval.cxx b/LidarCore/Filters/Processing/vtkAdaptiveOutlierRemoval.cxx index ebf31fc02d361801a3c02f2fea525f751f25d1d5..3258f247039b6c899d7ed5d7643ae43f25457fe9 100644 --- a/LidarCore/Filters/Processing/vtkAdaptiveOutlierRemoval.cxx +++ b/LidarCore/Filters/Processing/vtkAdaptiveOutlierRemoval.cxx @@ -18,6 +18,7 @@ #include "KDTreeVTKAdaptor.h" // VTK +#include #include #include #include @@ -98,9 +99,14 @@ void vtkAdaptiveOutlierRemoval::RemoveOutlier(vtkSmartPointer input vtkSmartPointer::New(); removePolyDataFilter->SetInputData(0, inputPointcloud); removePolyDataFilter->SetPointIds(pointIdsToRemove); - removePolyDataFilter->Update(); - outputPointcloud->ShallowCopy(removePolyDataFilter->GetOutput()); + // Clean removed points + vtkSmartPointer cleanFilter = vtkSmartPointer::New(); + cleanFilter->SetInputData(removePolyDataFilter->GetOutput()); + cleanFilter->PointMergingOff(); + cleanFilter->Update(); + + outputPointcloud->ShallowCopy(cleanFilter->GetOutput()); } //-----------------------------------------------------------------------------