-
Notifications
You must be signed in to change notification settings - Fork 33
Feat/new-filter-voxel-sor #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
mp2p_icp_filters/include/mp2p_icp_filters/FilterVoxelSOR.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /* _ | ||
| _ __ ___ ___ | | __ _ | ||
| | '_ ` _ \ / _ \| |/ _` | Modular Optimization framework for | ||
| | | | | | | (_) | | (_| | Localization and mApping (MOLA) | ||
| |_| |_| |_|\___/|_|\__,_| https://github.com/MOLAorg/mola | ||
|
|
||
| A repertory of multi primitive-to-primitive (MP2P) ICP algorithms | ||
| and map building tools. mp2p_icp is part of MOLA. | ||
|
|
||
| Copyright (C) 2018-2026 Jose Luis Blanco, University of Almeria, | ||
| and individual contributors. | ||
| SPDX-License-Identifier: BSD-3-Clause | ||
| */ | ||
|
|
||
| /** | ||
| * @file FilterVoxelSOR.h | ||
| * @brief Voxel-based Statistical Outlier Removal (SOR) filter. | ||
| * @author Jose Luis Blanco Claraco | ||
| * @date Jan 21, 2026 | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <mp2p_icp/metricmap.h> | ||
| #include <mp2p_icp_filters/FilterBase.h> | ||
| #include <mrpt/maps/CPointsMap.h> | ||
|
|
||
| namespace mp2p_icp_filters | ||
| { | ||
| /** | ||
| * @brief Voxel-based Statistical Outlier Removal (SOR) filter. | ||
| * | ||
| * This filter partitions the point cloud into voxels. Inside each voxel, it | ||
| * computes the average distance of each point to its k-nearest neighbors. | ||
| * Points are considered outliers if their average distance is significantly | ||
| * higher than the mean of the distances within that specific voxel. | ||
| * | ||
| * This is much faster than global SOR for large clouds as the KD-tree searches | ||
| * are localized and restricted to a small subset of points. | ||
| * | ||
| * When TBB is available, voxel processing is automatically parallelized for | ||
| * improved performance on multi-core systems. | ||
| * | ||
| * \ingroup mp2p_icp_filters_grp | ||
| */ | ||
| class FilterVoxelSOR : public mp2p_icp_filters::FilterBase | ||
| { | ||
| DEFINE_MRPT_OBJECT(FilterVoxelSOR, mp2p_icp_filters) | ||
| public: | ||
| FilterVoxelSOR(); | ||
|
|
||
| // See docs in FilterBase | ||
| void filter(mp2p_icp::metric_map_t& inOut) const override; | ||
|
|
||
| struct Parameters | ||
| { | ||
| void load_from_yaml(const mrpt::containers::yaml& c); | ||
|
|
||
| std::string input_layer = mp2p_icp::metric_map_t::PT_LAYER_RAW; | ||
| std::string output_layer_inliers; | ||
| std::string output_layer_outliers; | ||
|
|
||
| /** Size of the voxel for local processing [meters]. */ | ||
| float voxel_size = 2.0f; | ||
|
|
||
| /** Number of neighbors to analyze for each point locally. */ | ||
| uint32_t mean_k = 20; | ||
|
|
||
| /** Standard deviation multiplier threshold. */ | ||
| double std_dev_mul = 2.0; | ||
|
|
||
| /** Whether to use tsl::robin_map for voxel storage (faster in general) */ | ||
| bool use_tsl_robin_map = true; | ||
|
|
||
| /** Grain size for TBB parallelization (number of voxels per thread block). | ||
| * Larger values reduce overhead but may cause load imbalance. | ||
| * Only used if TBB is available at build time. | ||
| */ | ||
| size_t parallelization_grain_size = 10; | ||
| }; | ||
|
|
||
| /** Algorithm parameters */ | ||
| Parameters params; | ||
|
|
||
| protected: | ||
| void initialize_filter(const mrpt::containers::yaml& c) override; | ||
| }; | ||
|
|
||
| } // namespace mp2p_icp_filters | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.