Skip to content

Commit

Permalink
Fix ransac update of the iteration number (#6789)
Browse files Browse the repository at this point in the history
The update of the iteration number is forced to be non-negative (was negative if corres_inlier_ratio = 0.0)
  • Loading branch information
nicolaloi committed May 23, 2024
1 parent 69786b6 commit b68eae1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- Fix log error message for `probability` argument validation in `PointCloud::SegmentPlane` (PR #6622)
- Fix macOS arm64 builds, add CI runner for macOS arm64 (PR #6695)
- Fix KDTreeFlann possibly using a dangling pointer instead of internal storage and simplified its members (PR #6734)
- Fix RANSAC early stop if no inliers in a specific iteration (PR #6789)
- Fix segmentation fault (infinite recursion) of DetectPlanarPatches if multiple points have same coordinates (PR #6794)

## 0.13
Expand Down
8 changes: 5 additions & 3 deletions cpp/open3d/pipelines/registration/Registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,15 @@ RegistrationResult RegistrationRANSACBasedOnCorrespondence(
max_correspondence_distance,
transformation);

// Update exit condition if necessary.
// If confidence is 1.0, then it is safely inf, we always
// consume all the iterations.
// Update exit condition if necessary
double est_k_local_d =
std::log(1.0 - criteria.confidence_) /
std::log(1.0 -
std::pow(corres_inlier_ratio, ransac_n));
// This prevents having a negative number of iterations:
// est_k_local_d = -inf if corres_inlier_ratio = 0.0
est_k_local_d =
est_k_local_d < 0 ? est_k_local : est_k_local_d;
est_k_local =
est_k_local_d < est_k_global
? static_cast<int>(std::ceil(est_k_local_d))
Expand Down

0 comments on commit b68eae1

Please sign in to comment.