-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Remove dead code corresponding to SOLVEPNP_DLS and SOLVEPNP_UPNP flags #27358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5.x
Are you sure you want to change the base?
Conversation
@s-trinh Is the PR ready for review? |
Hello @ivashmak In OpenCV 4, When searching, it looks like the DLS method suffers from a singularity in the rotation parameterization, eg. from or this paper: I have seen that in USAC: opencv/modules/3d/src/usac/ransac_solvers.cpp Lines 374 to 376 in 2e6a0ca
an implementation of the DLS method is used. My questions are:
Thanks. |
These flags are internally mapped to SOLVEPNP_EPNP for more than 10 years and thus unavailable since then.
4993115
to
1c72264
Compare
Hi @s-trinh,
|
Thanks for the answers @ivashmak
I have not encountered these issues, at least not situations where the DLS singularity could have been specifically pinpointed.
Is it this one? opencv/modules/3d/src/usac/pnp_solver.cpp Line 16 in 2e6a0ca
I have experienced with poor accuracy with the P3P solver in opencv/modules/calib3d/src/p3p.cpp Lines 211 to 221 in afe5b22
which seem to corroborate with my experiments. So actually it could be a good idea to replace the P3P in Is there somewhere something to have a list of API breaking changes in OpenCV 5? If the change of default values of |
Cleaning up code makes sense. I would leave DLS in USAC, because it can significantly improves noisy models from the P3P algorithm. In the documentation, we can make it clear that USAC has 2 solvers.
Almost, P6P works in the same way as the non-minimal PnP solver, which is some lines below: opencv/modules/3d/src/usac/pnp_solver.cpp Line 153 in 2e6a0ca
It basically, builds a large covariance matrix from all inliers, and finds the least squares solution, a projection matrix, which is decomposed later to R and T. While DLS predicts R and T directly, making it more accurate.
I know that my P3P version is faster, I am not sure (do not remember) about accuracy from direct comparison with OpenCV P3P. However, I tested before (around 3 years ago) that USAC PnP (overall) is faster and more accurate than the other OpenCV PnP methods. |
Cf #27330
SOLVEPNP_DLS
andSOLVEPNP_UPNP
flags are internally mapped to SOLVEPNP_EPNP for more than 10 years.Remove these functions in OpenCV 5 to clean-up the codebase and avoid potential misconceptions where someone thinks he uses DLS/UPnP methods while it is just internally mapped to EPnP.
Pros:
Cons:
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.