Skip to content
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

ShapeChecker.IsQuadrilateral System.ArgumentOutOfRangeException #36

Open
OrgesKreka opened this issue Mar 4, 2019 · 0 comments
Open

Comments

@OrgesKreka
Copy link

I am using AForge to detect rectangles on image and the method shapeChecker.IsQuadrilateral throws System.ArgumentOutOfRangeException.
I tracked the execution and it looks like the exception happens in method FindQuadrilateralCorners of class PointsCloud.
Specifically at this part of the code:

// sort other points in counter clockwise order
            float k1 = ( corners[1].X != corners[0].X ) ?
                ( (float) ( corners[1].Y - corners[0].Y ) / ( corners[1].X - corners[0].X ) ) :
                ( ( corners[1].Y > corners[0].Y ) ? float.PositiveInfinity : float.NegativeInfinity );

            float k2 = ( corners[2].X != corners[0].X ) ?
                ( (float) ( corners[2].Y - corners[0].Y ) / ( corners[2].X - corners[0].X ) ) :
                ( ( corners[2].Y > corners[0].Y ) ? float.PositiveInfinity : float.NegativeInfinity );

where it looks like the corners array has only two elements.
As in photo:
capture

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

No branches or pull requests

1 participant