Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

mlourakis
Copy link
Contributor

@mlourakis mlourakis commented Mar 9, 2022

This PR mirrors to OpenCV changes made recently to the official SQPnP implementation

Pull Request Readiness Checklist

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=linux,docs

- optimized the calculation of qa_sum by moving equal elements outside the loop
- unrolled copying of the lower triangle of omega
- substituted SVD with eigendecomposition in the factorization of omega (2-3 times faster)
- fixed the initialization of lambda in FOAM
- added a cheirality test that checks a solution on all 3D points rather than on their mean. The old test rejected valid poses in some cases
- fixed some typos & errors in comments
@mlourakis mlourakis marked this pull request as ready for review March 9, 2022 14:38
@mlourakis mlourakis marked this pull request as draft March 10, 2022 11:21
Eigen decomposition seems to yield larger errors in certain tests, reverted to SVD
@mlourakis mlourakis marked this pull request as ready for review March 10, 2022 11:32
@mlourakis mlourakis marked this pull request as draft March 10, 2022 11:47
Added nearestRotationMatrixSVD()
Previous nearestRotationMatrix() renamed to nearestRotationMatrixFOAM() and reverts to nearestRotationMatrixSVD() for singular matrices
@mlourakis mlourakis marked this pull request as ready for review March 11, 2022 16:15
@alalek
Copy link
Member

alalek commented Mar 11, 2022

/cc @nathanrgodwin as author of initial contribution

Fixed the order of checks in PoseSolver::solveInternal()
@asmorkalov asmorkalov requested a review from victor1234 April 15, 2022 08:37
@asmorkalov
Copy link
Contributor

@victor1234 Please take a look.

@victor1234
Copy link
Contributor

@mlourakis as I understand main improvements are:

  • fixed some typos & errors in comments
  • calculation time optimization
  • fixies: initialization of lambda, cheirality test

How did you measure calculation time improvements?
What was practically affected by the fixies? I mean in which cases the old solution did not work?

Eigen decomposition seems to yield larger errors in certain tests, reverted to SVD

In which cases? Is this a bug of implementation?

Thanks

@mlourakis
Copy link
Contributor Author

mlourakis commented Apr 29, 2022 via email

@victor1234
Copy link
Contributor

Great

@victor1234 victor1234 requested a review from opencv-pushbot May 5, 2022 08:50
@asmorkalov asmorkalov requested review from vpisarev and removed request for alalek and opencv-pushbot May 13, 2022 07:31
@vpisarev
Copy link
Contributor

@mlourakis, thank you very much for keeping OpenCV version of your code up-to-date! 👍

@opencv-pushbot opencv-pushbot merged commit 8d0fbc6 into opencv:4.x May 13, 2022
@alalek alalek mentioned this pull request Aug 21, 2022
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
Fixes and optimizations for the SQPnP solver

* Fixes and optimizations

- optimized the calculation of qa_sum by moving equal elements outside the loop
- unrolled copying of the lower triangle of omega
- substituted SVD with eigendecomposition in the factorization of omega (2-3 times faster)
- fixed the initialization of lambda in FOAM
- added a cheirality test that checks a solution on all 3D points rather than on their mean. The old test rejected valid poses in some cases
- fixed some typos & errors in comments

* reverted to SVD

Eigen decomposition seems to yield larger errors in certain tests, reverted to SVD

* nearestRotationMatrixSVD

Added nearestRotationMatrixSVD()
Previous nearestRotationMatrix() renamed to nearestRotationMatrixFOAM() and reverts to nearestRotationMatrixSVD() for singular matrices

* fixed checks order

Fixed the order of checks in PoseSolver::solveInternal()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants