Open3D
Open3D copied to clipboard
Fix ransac update of the iteration number
The update of the iteration number is forced to be non-negative (was negative if corres_inlier_ratio = 0.0)
Type
- [x] Bug fix (non-breaking change which fixes an issue): Fixes #6709
- [ ] 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
Issue 6709: RANSAC incorrectly exits early if corres_inlier_ratio is 0.0 during a RANSAC iteration.
Checklist:
- [x] I have run
python util/check_style.py --applyto apply Open3D code style to my code. - [x] 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.
- [x] I will follow up and update the code if CI fails.
- [x] For fork PRs, I have selected Allow edits from maintainers.
Description
The corres_inlier_ratio of a specific RANSAC iteration is employed to update est_k_local_d (the maximum number of iterations to be performed) using the formula $est\_k\_local\_d={\text{log} (1-criteria.confidence\_ ) \over \text{log} ( 1-corres\_inlier\_ratio^{ransac\_n})}$.
However, if corres_inlier_ratio = 0.0 then est_k_local_d = -inf. Hence, the maximum number of iterations is negative and RANSAC exits early.
Instead, we want RANSAC to continue to test new transformations. This PR adds a check to ensure that est_k_local_d is non-negative.
Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.