Skip to content

Improved performance of function geometry::PointCloud::RemoveRadiusOutliers, function geometry::ClusterDBSCAN and feature counting - #6676

Merged
ssheorey merged 5 commits into
isl-org:mainfrom
PiatrouskiIM:main
Aug 4, 2026
Merged

Conversation

@PiatrouskiIM

Copy link
Copy Markdown
Contributor

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes #
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

Performance improvements.

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

  1. Determining the presence of a sufficient number of neighbors in a given radius in the geometry::PointCloud::RemoveRadiusOutliers function can be carried out by the SearchHybrid function instead of the SearchRadius function.
    2.0 When clustering in PointCloud::ClusterDBSCAN, a set of visited points is created for each new cluster. Elements are added to this set based on the presence of a certain label. This set is subsequently used to add elements to the set of unvisited points. The same thing can be done much more efficiently based only on labels.
    2.1 And there is also no need to represent the collection of unvisited points as an unordered set, given that the only difference is the additional protection against duplication when adding a new element.
  2. When counting features in ComputePairFeatures, angles are compared, but given that the arc cosine is a monotonically decreasing function, its influence on the comparison result is limited to a change in sign.

@update-docs

update-docs Bot commented Mar 3, 2024

Copy link
Copy Markdown

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

@ssheorey

ssheorey commented Mar 5, 2024

Copy link
Copy Markdown
Member

Hi @PiatrouskiIM thanks for this optimization! Can you provide some benchmark results of speed comparisons with the code in the main branch? You can use any reasonably sized data (eg something from the data module should be useful).

@ssheorey
ssheorey requested review from benjaminum and ssheorey March 5, 2024 00:22
@benjaminum

Copy link
Copy Markdown
Contributor

@PiatrouskiIM SearchHybrid is implemented on top of radius search. Can you give an idea of which changes contribute the most to the performance improvement?

@PiatrouskiIM

Copy link
Copy Markdown
Contributor Author

I was mistaken about the presence of performance improvements when switching to SearchHybrid (my tests sets were regenerated when running benchmark of the another implementation).

@PiatrouskiIM

Copy link
Copy Markdown
Contributor Author

@benjaminum, SearchHybrid is implemented on top of SearchKNN, which is usually implemented differently (I won’t say for nanoflann, but I saw the implementation from scipy written in c). I was wrong about improving performance; it’s more likely a trade-off in favor of searching by radius. There are improvements only if there are many more points in the radius than the set threshold. I can prepare a more detailed comparison to find a visual tradeoff, but it seems that most often searching by radius is almost twice as fast.

@benjaminum

Copy link
Copy Markdown
Contributor

Sounds good. Looking forward to the comparison!

@ssheorey ssheorey added the status / needs info Waiting for information from reporter / author label Oct 3, 2024
@ssheorey
ssheorey requested a review from Copilot June 10, 2026 22:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on performance optimizations in legacy (Eigen-based) point cloud processing and registration feature computation by reducing expensive neighbor-search work and simplifying DBSCAN bookkeeping.

Changes:

  • Use KDTreeFlann::SearchHybrid in PointCloud::RemoveRadiusOutliers to early-exit once enough neighbors are found.
  • Refactor PointCloud::ClusterDBSCAN cluster expansion to avoid per-cluster unordered_set tracking, relying on labels and a vector worklist instead.
  • Simplify ComputePairFeatures by replacing acos(fabs(..)) comparisons with an equivalent fabs(..) comparison.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
cpp/open3d/pipelines/registration/Feature.cpp Avoids acos() calls in pair-feature ordering logic.
cpp/open3d/geometry/PointCloudCluster.cpp Refactors DBSCAN expansion loop to reduce hashing overhead.
cpp/open3d/geometry/PointCloud.cpp Switches radius outlier counting to hybrid search with a max neighbor cap.

Comment thread cpp/open3d/geometry/PointCloudCluster.cpp Outdated
Comment thread cpp/open3d/geometry/PointCloud.cpp Outdated
@ssheorey ssheorey added this to the v0.20 milestone Jul 25, 2026
@ssheorey

ssheorey commented Aug 4, 2026

Copy link
Copy Markdown
Member

Reverted switch from radius -> hybrid search:

@benjaminum, SearchHybrid is implemented on top of SearchKNN, which is usually implemented differently (I won’t say for nanoflann, but I saw the implementation from scipy written in c). I was wrong about improving performance; it’s more likely a trade-off in favor of searching by radius. There are improvements only if there are many more points in the radius than the set threshold. I can prepare a more detailed comparison to find a visual tradeoff, but it seems that most often searching by radius is almost twice as fast.

@ssheorey
ssheorey merged commit f564173 into isl-org:main Aug 4, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status / needs info Waiting for information from reporter / author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants