Conversation
modules/calib3d/src/solvepnp.cpp
Outdated
| Mat _local_inliers; | ||
| for(int i = 0; i < npoints; i++) | ||
| { | ||
| _local_inliers.push_back(i); |
There was a problem hiding this comment.
Don't use push_back here, required size is known.
modules/calib3d/src/solvepnp.cpp
Outdated
| { | ||
| _local_inliers.push_back(i); | ||
| } | ||
| _local_inliers.copyTo(_inliers); |
There was a problem hiding this comment.
Copy can be avoided:
_inliers.create(...);
Mat _local_inliers = _inliers.getMat()
//fill _local_inliers|
Fix also an issue when |
|
@catree is the source code + dataset that you used for the video available somewhere? |
|
👍 |
@tompollok No, it is my own data. |
… number of model points. Enable useExtrinsicGuess parameter. Return rvec and tvec estimated using all the inliers instead of the best rvec and tvec estimated during the Minimal Sample Sets step. Document the behavior of solvePnPRansac.
8e18018 to
98c78e0
Compare
|
could this make it into 3.3? |
This pullrequest changes
This PR is an attempt to improve and clarify the "algorithm" behind
solvePnPRansac, see also #8782.From what I have understood of the code:
rvecandtvecare estimated two times: once here and another time heresolvePnPuseExtrinsicGuessparameters has no effect asransac_kernel_methodis set by default toSOLVEPNP_EPNPorSOLVEPNP_P3P,SOLVEPNP_AP3Pby the user and is not used for the final call tosolvePnPuseExtrinsicGuessis used withsolvePnPwith all the inlierssolvePnPRansacrvecandtvecestimated during the Minimal Sample Sets step and notrvecandtvecestimated using all the inliersBefore this PR:
With this PR:
At first sight, the accuracy is worse. But before the function returned the best
rvecandtvecestimated during the Minimal Sample Sets step and nowrvecandtvecestimated using all the inliers, theRANSAC parameters could be not optimal here.