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

Skip to content

Conversation

TuNanTang
Copy link
Contributor

@TuNanTang TuNanTang commented Mar 14, 2023

1). At least 5 points can fit an ellipse
2). The result of fitEllipse、 fitEllipseAMS、fitEllipseDirect maybe different,I think it's better to draw the different result,rather than "continue".
3). Need to check the size of boxAMS/boxDirect ,not the size of box,after fitEllipseAMS、fitEllipseDirect.

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

Copy link
Contributor

@mshabunin mshabunin left a comment

Choose a reason for hiding this comment

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

BTW, it would be cool to process key strokes and toggle active algorithms when e.g. 1, 2 and 3 keys have been pressed.

if( MAX(box.size.width, box.size.height) > MIN(box.size.width, box.size.height)*30 ||
MAX(box.size.width, box.size.height) <= 0 ||
MIN(box.size.width, box.size.height) <= 0){continue;};
//size.height >= size.width awalys,only if the pts are on a line or at the same point,size.width=0
Copy link
Contributor

Choose a reason for hiding this comment

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

size.height >= size.width awalys

Is this behavior built into fitEllipse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if( box.size.width > box.size.height )
{
    float tmp;
    CV_SWAP( box.size.width, box.size.height, tmp );
    box.angle = (float)(fmod((90 + theta*180/CV_PI),180.0)) ;
}

Yes,in the function of fitEllipseDirectfitEllipseNoDirectfitEllipseAMS include above code.
https://github.com/opencv/opencv/blob/4.x/modules/imgproc/src/shapedescr.cpp

@TuNanTang
Copy link
Contributor Author

TuNanTang commented Mar 15, 2023

BTW, it would be cool to process key strokes and toggle active algorithms when e.g. 1, 2 and 3 keys have been pressed.

That's a good idea.
But draw the results at the same time will be easy to see the differences.

Optimize&Fix fitEllipse sample
@TuNanTang TuNanTang force-pushed the OptimizeFixFitEllipseSample branch from a3c18af to 68e2df5 Compare March 15, 2023 13:36
@asmorkalov asmorkalov added this to the 4.8.0 milestone Mar 17, 2023
@asmorkalov asmorkalov merged commit 94b3bad into opencv:3.4 Mar 17, 2023
@asmorkalov asmorkalov mentioned this pull request Apr 20, 2023
@asmorkalov asmorkalov mentioned this pull request May 31, 2023
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.

3 participants