Bugfix for solvePnPRansac with SOLVEPNP_ITERATIVE#22914
Merged
asmorkalov merged 1 commit intoopencv:3.4from Dec 22, 2022
Merged
Bugfix for solvePnPRansac with SOLVEPNP_ITERATIVE#22914asmorkalov merged 1 commit intoopencv:3.4from
asmorkalov merged 1 commit intoopencv:3.4from
Conversation
The current implementation overwrites the result rotation and translation in every iteration. If SOLVEPNP_ITERATIVE was run as a refinement it will start from the incorrect initial transformation thus degrading the final outcome.
Contributor
|
@tozanski Could you add simple test or at least example, where the patch significantly improves result? |
vpisarev
approved these changes
Dec 21, 2022
Contributor
|
thank you! the whole solvePnPRansac looks broken to me, but your patch makes it a little less buggy :) |
Contributor
|
I have not found simple way to test the fix. Merged as is. |
Merged
alalek
reviewed
Dec 24, 2022
Merged
vrabaud
reviewed
Jan 12, 2023
| try | ||
| { | ||
| result = solvePnP(opoints_inliers, ipoints_inliers, cameraMatrix, | ||
| if (flags == SOLVEPNP_ITERATIVE && !useExtrinsicGuess) |
Contributor
There was a problem hiding this comment.
Do we need this condition ? Shouldn't that be for all methods ? Thx
Contributor
Author
There was a problem hiding this comment.
I think the issue only occurs forSOLVEPNP_ITERATIVE because AFAIK the other methods do not use extrinsic guess which was overwritten in each RANSAC iteration
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The current implementation overwrites the result rotation and translation in every iteration. If SOLVEPNP_ITERATIVE was run as a refinement it will start from the incorrect initial transformation thus degrading the final outcome.
There is not bug report I am aware of nor any test or documentation that references the existence of this bug
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.