Skip to content

new feature: update ellipse detector using projective invariant pruning #3322

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

Merged
merged 16 commits into from
Oct 24, 2022
Merged

new feature: update ellipse detector using projective invariant pruning #3322

merged 16 commits into from
Oct 24, 2022

Conversation

haku-huang
Copy link
Contributor

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • 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 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

@haku-huang
Copy link
Contributor Author

@sturkmen72 Hello, we have passed the test and the code has been modified according to your instructions.

@sturkmen72
Copy link
Contributor

sturkmen72 commented Aug 10, 2022

@MisakiCoca i am a common contributor. a developers team member will review.

consider my additional remarks as follows :

  1. ellipseDetector() seems a class name. maybe something like findEllipses will be better.
  2. you can see the preview of the documentation https://pullrequest.opencv.org/buildbot/export/pr_contrib/3322/docs/d1/d05/group__ximgproc__ellipse__detector.html#ga4f98330bb312dd8f42046105e646b390

just for a function I think no need to add a section in modules part https://pullrequest.opencv.org/buildbot/export/pr_contrib/3322/docs/df/d2d/group__ximgproc.html

  1. I did not test your code but what is your opinion about

yours : EllipseDetectorTest.ManySmallEllipses (101787 ms)
and existing ellipse finding EdgeDrawing : test ximgproc_ED.ManySmallCircles (875 ms)

@haku-huang
Copy link
Contributor Author

@MisakiCoca i am a common contributor. a developers team member will review.

consider my additional remarks as follows :

  1. ellipseDetector() seems a class name. maybe something like findEllipses will be better.
  2. you can see the preview of the documentation https://pullrequest.opencv.org/buildbot/export/pr_contrib/3322/docs/d1/d05/group__ximgproc__ellipse__detector.html#ga4f98330bb312dd8f42046105e646b390

just for a function I think no need to add a section in modules part https://pullrequest.opencv.org/buildbot/export/pr_contrib/3322/docs/df/d2d/group__ximgproc.html

  1. I did not test your code but what is your opinion about

yours : EllipseDetectorTest.ManySmallEllipses (101787 ms) and existing ellipse finding EdgeDrawing : test ximgproc_ED.ManySmallCircles (875 ms)

Thank you very much for your reply.

We have completed the revisions for the first and second points based on your advice.

Regarding the third point about our running speed:

Our approach can be roughly summarized as enumerating the arcs in each quadrant and applying a pruning strategy.
Thus when there are too many arcs, our speed will be slower than algorithms such as Hough, who are based on point sampling. In such situation, however, our method will have higher accuracy.

In thress realistic datasets with moderate amount of ellipses, the advantages of both the computational speed and the accuracy of our method are very obvious, as shown in the following Figure.
Figure.1
Where theRHT and Qi et al., denotes the Random Hough Transform and ours, respectively.

Compared to some other arc-based approach, our computational speed has been improved significantly while retaining accuracy.

Figure.2
Where the Jia denotes our method. Pre, Rec are abbreviations of precision and recall.

We have removed the ManySmallEllipses from tests, we would be honored if these descriptions could answer your questions.

@haku-huang
Copy link
Contributor Author

@asmorkalov Thank you very much for your attention! What can i do for the macOS-ARM64 failure?

@asmorkalov
Copy link
Contributor

It looks like CI issue or system configuration issue on our side. Please ignore it for now.

@haku-huang
Copy link
Contributor Author

@asmorkalov Hello, is there anything I can do to aid in the merging of this PR?

@haku-huang
Copy link
Contributor Author

@asmorkalov Hello, I have completed all the modifications you suggested.

@haku-huang
Copy link
Contributor Author

@asmorkalov Sorry, there were some issues with the previous testing session, but they have already been resolved.

@haku-huang haku-huang requested review from asmorkalov and removed request for asmorkalov October 20, 2022 10:23
@haku-huang
Copy link
Contributor Author

@asmorkalov The warning from clang in macOS caused by C.21 have been solved.

@haku-huang
Copy link
Contributor Author

@asmorkalov All of the CI/CD checks have passed, thank you for your continuous help. What else can I do for you?

Copy link
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me in general besides srand.

@haku-huang
Copy link
Contributor Author

haku-huang commented Oct 24, 2022

@asmorkalov Thank you so much for your continuous help!

@asmorkalov asmorkalov merged commit 11b056b into opencv:4.x Oct 24, 2022
@haku-huang haku-huang deleted the ellipse branch October 24, 2022 14:45
namespace opencv_test { namespace {


TEST(FindEllipsesTest, EllipsesOnly)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In debug build mode there is catched out of boundary access issue:

[ RUN      ] FindEllipsesTest.EllipsesOnly
unknown file: Failure
C++ exception with description "OpenCV(4.6.0-dev) /build/precommit-contrib_linux64_no_opt/4.x/opencv/modules/core/include/opencv2/core/mat.inl.hpp:1603: error: (-215:Assertion failed) 0 <= y && y < size.p[0] in function 'operator[]'
" thrown in the test body.
[  FAILED  ] FindEllipsesTest.EllipsesOnly (18 ms)

@misakicoca Could have a chance to look on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I have reproduced this issue locally so far and I will fix this bug in the following days.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alalek I have found the source of the error and found a way to fix it, how should I submit the code change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for looking on this!
Please open a new PR with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants