Fix and add tests for ellipse fitting#26694
Fix and add tests for ellipse fitting#26694MaximSmolskiy wants to merge 10 commits intoopencv:4.xfrom
Conversation
e3c66ca to
d3092de
Compare
|
👍 great if it can solves all these issues I have proposed this pull request: Add getClosestEllipsePoints() function to get the closest point on an ellipse Feel free to comment if there is something missing or if you think this function is useless, etc. |
|
Thanks a lot for the contribution! |
|
Yes, test |
…llipse-fitting Improve robustness for ellipse fitting #26773 ### Pull Request Readiness Checklist Related to #26694 Current noise addition is not very good because for example it turns degenerate case of one horizontal line into degenerate case of two parallel horizontal lines Improving noise addition leads to improved robustness of algorithms See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] 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 - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
|
@MaximSmolskiy May I close this pr? |
…-for-ellipse-fitting Improve robustness for ellipse fitting opencv#26773 ### Pull Request Readiness Checklist Related to opencv#26694 Current noise addition is not very good because for example it turns degenerate case of one horizontal line into degenerate case of two parallel horizontal lines Improving noise addition leads to improved robustness of algorithms See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] 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 - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
…itEllipseAMS Improve robustness for fitEllipseAMS #26810 ### Pull Request Readiness Checklist Related to #26694 Added functionality to add noise to points in degenerate cases and try again for `fitEllipseAMS`. `fitEllipseNoDirect` and `fitEllipseDirect` already have this See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] 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 - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
@asmorkalov I think no, because issues are still not fixed It's pretty obvious to me what the matter is.
So, to avoid problems with infinite recursion in this patch, I can offer to call |
Please go ahead! |
…b.com/MaximSmolskiy/opencv into fix-and-add-tests-for-ellipse-fitting
@asmorkalov Locally ellipse fitting tests are passed and images for issues from description haven't changed |
|
Some tests failed - I'll deal with them |
…-for-ellipse-fitting Improve robustness for ellipse fitting opencv#26773 ### Pull Request Readiness Checklist Related to opencv#26694 Current noise addition is not very good because for example it turns degenerate case of one horizontal line into degenerate case of two parallel horizontal lines Improving noise addition leads to improved robustness of algorithms See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] 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 - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
…-for-fitEllipseAMS Improve robustness for fitEllipseAMS opencv#26810 ### Pull Request Readiness Checklist Related to opencv#26694 Added functionality to add noise to points in degenerate cases and try again for `fitEllipseAMS`. `fitEllipseNoDirect` and `fitEllipseDirect` already have this See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] 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 - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
|
I merged 4.x branch, but there is still test failure on mac M1: |
|
Reproduced the issue locally with debug build on nvidia jetson. Will try to debug it. |
|
@MaximSmolskiy Could you rebase and fix conflicts after your previous patch? |
@asmorkalov I will do it, but I think there is still a lot of work to do here |
|
Details |
|
@MaximSmolskiy Could you take a look on the failed tests? |
Pull Request Readiness Checklist
The main problem is that
fitEllipseNoDirectfunction on first step finds optimal solution from space of all conic curves (besides ellipse there are at least hyperbola and parabola). It does not impose any special restrictions on solution, so that it must be only ellipse. So, found curve may easily be not ellipse. But all the following steps consider this to be ellipse, which is why we get very strange and incorrect results.As a solution, we can add fallback to
fitEllipseDirectfunction as soon as we realized that we got not ellipse - as has already been done infitEllipseAMSfunctionopencv/modules/imgproc/src/shapedescr.cpp
Lines 641 to 689 in 4d26e16
Fix #26078
Fix #26360
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.