From 54c84fa22ba1d4f09b992eed1e21687d13dcd455 Mon Sep 17 00:00:00 2001 From: Tong Fu Date: Mon, 17 Mar 2025 16:04:07 +0100 Subject: [PATCH] [fix] Clean isolated points in outlier removal filter --- .../Filters/Processing/vtkAdaptiveOutlierRemoval.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/LidarCore/Filters/Processing/vtkAdaptiveOutlierRemoval.cxx b/LidarCore/Filters/Processing/vtkAdaptiveOutlierRemoval.cxx index ebf31fc02..3258f2470 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()); } //----------------------------------------------------------------------------- -- GitLab