Move further towards KdTreeNanoflann#6413
Move further towards KdTreeNanoflann#6413mvieth wants to merge 3 commits intoPointCloudLibrary:masterfrom
Conversation
7bb1400 to
9667857
Compare
ccbc4e7 to
4c16e08
Compare
Extend `autoSelectMethod` to types that do not have xyz-coordinates (i.e. features types)
4c16e08 to
1a469fc
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends pcl::search::autoSelectMethod usage beyond XYZ point types (notably toward feature/descriptor types) and updates several tools and registration components to rely on the auto-selected search backend, while also introducing compile-time dimension constants (NR_DIMS) in point representations to support KdTreeNanoflann specialization.
Changes:
- Replace direct
KdTree/KdTreeFLANNusage withpcl::search::autoSelectMethod(...)in tools and registration feature search paths. - Broaden precompiled instantiations of
AutoSelectMethodand updateautoSelectMethodinternals to avoid xyz-only code paths for non-xyz types. - Add
NR_DIMScompile-time constants to point/feature representations and add a unit test to assert consistency with runtime dimensions.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/pcd_viewer.cpp | Switch point picking search to autoSelectMethod and Search::Ptr. |
| tools/compute_hausdorff.cpp | Use autoSelectMethod for 1-NN distance computations. |
| tools/boundary_estimation.cpp | Remove unused commented search-method line. |
| test/common/test_common.cpp | Add coverage asserting DefaultPointRepresentation::NR_DIMS matches runtime dimensions. |
| search/src/auto.cpp | Instantiate AutoSelectMethod for PCL_POINT_TYPES (incl. feature types). |
| search/include/pcl/search/impl/auto.hpp | Extend selection logic for non-xyz types and specialize KdTreeNanoflann with NR_DIMS. |
| registration/include/pcl/registration/sample_consensus_prerejective.h | Change feature tree type to pcl::search::Search<FeatureT>::Ptr. |
| registration/include/pcl/registration/impl/sample_consensus_prerejective.hpp | Build feature search tree via autoSelectMethod. |
| registration/include/pcl/registration/ia_ransac.h | Change feature tree type to pcl::search::Search<FeatureT>::Ptr and adjust ctor init. |
| registration/include/pcl/registration/impl/ia_ransac.hpp | Build feature search tree via autoSelectMethod. |
| registration/include/pcl/registration/ia_fpcs.h | Replace reciprocal kd-tree alias with pcl::search::Search<PointSource>. |
| registration/include/pcl/registration/impl/ia_fpcs.hpp | Use autoSelectMethod for intermediate-point radius searches. |
| people/include/pcl/people/impl/ground_based_people_detection_app.hpp | Rely on EuclideanClusterExtraction’s internal auto-selected tree (remove manual tree wiring). |
| common/include/pcl/point_representation.h | Add NR_DIMS for default point/feature representations and propagate into specializations. |
| common/include/pcl/impl/point_types.hpp | Add descriptorSize trait specialization for NormalBasedSignature12. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return searcher; | ||
|
|
||
| if constexpr (pcl::traits::has_xyz_v<PointT>) { | ||
| searcher = new pcl::search::Octree<PointT> (0.01); // TODO a better heuristic to choose octree resolution? |
There was a problem hiding this comment.
Should we add it as an optional agurment to autoSelectMethod ?
Else there is no way to change it - as it can't be done afterwards.
One can still create an octree "manually" if one knows it better fits.
There was a problem hiding this comment.
I would rather not add the octree resolution as an argument. I think autoSelectMethod should hide any details related to the specific search method used, and determine all settings itself (e.g. resolution, or number of points per node for KdTreeNanoflann). I think having a resolution argument would kind of defeat the purpose of autoSelectMethod: being able to just request a search object without worrying which method is used or with which parameters. And like you said - if someone specifically wants an octree with a certain resolution, they can always create it manually and e.g. pass it to any PCL class via setSearchMethod.
I have added octree here only preliminarily because I think it will be faster than the BruteForce search even if the octree resolution is not perfectly chosen. I think in the future we could try to determine a good resolution via the 3D bounding box of the cloud, or we check whether we make the dynamic depth feature available in pcl::search::Octree.
Extend
autoSelectMethodto types that do not have xyz-coordinate (i.e. features types)