Repository navigation
Pass RANSAC parameters as function input - #10569
Conversation
|
please check |
| int idx[RANSAC_SIZE0]; | ||
| Point2f a[RANSAC_SIZE0]; | ||
| Point2f b[RANSAC_SIZE0]; | ||
| Point2f *a =new Point2f[RANSAC_SIZE0]; |
There was a problem hiding this comment.
std::vector<Point2f> a(RANSAC_SIZE0); may be better, since it
abstracts away new/delete.
There was a problem hiding this comment.
I agree; also, those vectors should better be placed outside of the loop.
| */ | ||
| CV_EXPORTS_W Mat estimateRigidTransform( InputArray src, InputArray dst, bool fullAffine ); | ||
| CV_EXPORTS_W Mat estimateRigidTransform( InputArray src, InputArray dst, bool fullAffine, int RANSAC_MAX_ITERS=500, double RANSAC_GOOD_RATIO=0.5, | ||
| int RANSAC_SIZE0=3); |
There was a problem hiding this comment.
- In OpenCV 3.x we preserve binary compatibility. So you need to add another function with those extra parameters.
- the parameters should use mixed case names, not all-capital names that are normally used for constants.
|
|
||
| const int COUNT = 15; | ||
| const int WIDTH = 160, HEIGHT = 120; | ||
| const int RANSAC_MAX_ITERS = 500; |
There was a problem hiding this comment.
Since you now pass parameters instead of using constants, there should be some code added to check the parameters for reasonable value ranges. For example, RANSAC_SIZE0 should not be smaller than 3
|
@vpisarev: What do you think about We might want to remove this function in OpenCV 4.0. |
|
@hrnr I will check estimateAffine2D and estimateAffinePartial2D and see if they give me the functionality I need. Thanks for the info. If they do, I will close this, if not I will make the required changes. @vpisarev @csukuangfj thanks for the review |
|
@hrnr estimateAffine2D and estimateAffinePartial2D do not have the option of setting the minimum acceptable percentage of inliers for a model to be valid. I would like to go ahead with this PR because that is what I need and it was easy to add it here. |
Replace array with vector. Correct naming convention for input variables. Add checks on input variables.
|
let's finally merge it in. It's for 3.4 branch; in OpenCV 4.0 we will probably revise RANSAC kernels and remove redundant functionality 👍 |
* Pass RANSAC parameters as function input * Clean up unnecessary code * Keep the original function signature * Clean up based on PR comments Replace array with vector. Correct naming convention for input variables. Add checks on input variables. * Use vector instead of array for dynamic size * Revert change. * Use dynamic array * Fix wrong syntax in array allocation * Undo change * Fix variable name * Use vector and not array * fixed compile warning on Windows
This pullrequest changes
This pull request changes estimateRigidTransform so it takes as input some RANSAC parameters instead of having them hardcoded in the function.