| 44 | #include <pcl/apps/point_cloud_editor/cloud.h> |
| 45 | |
| 46 | void |
| 47 | DenoiseCommand::execute () |
| 48 | { |
| 49 | Cloud3D temp_cloud; |
| 50 | // denoise |
| 51 | // uses point neighborhood statistics to filter outlier data. |
| 52 | // For a more detailed explanation, see PCL's tutorial on denoising: |
| 53 | // http://pointclouds.org/documentation/tutorials/statistical_outlier.php |
| 54 | pcl::StatisticalOutlierRemoval<Point3D> filter(true); |
| 55 | filter.setInputCloud(cloud_ptr_->getInternalCloud().makeShared()); |
| 56 | filter.setMeanK(mean_); |
| 57 | filter.setStddevMulThresh (threshold_); |
| 58 | // filtering and back up |
| 59 | filter.setNegative(false); |
| 60 | filter.filter(temp_cloud); |
| 61 | // back up the removed indices. |
| 62 | pcl::IndicesConstPtr indices_ptr = filter.getRemovedIndices(); |
| 63 | for(const auto &it : *indices_ptr) |
| 64 | removed_indices_.addIndex(static_cast<unsigned int>(it)); |
| 65 | // back up the removed points. |
| 66 | removed_points_.set(cloud_ptr_, removed_indices_); |
| 67 | // remove the noisy points. |
| 68 | cloud_ptr_->remove(removed_indices_); |
| 69 | selection_ptr_->clear(); |
| 70 | } |
| 71 | |
| 72 | void |
| 73 | DenoiseCommand::undo () |
nothing calls this directly
no test coverage detected