Skip to content

Get assert when testing on my image, what does it mean? #3

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

Closed
AndreyStille opened this issue Jan 4, 2022 · 2 comments
Closed

Get assert when testing on my image, what does it mean? #3

AndreyStille opened this issue Jan 4, 2022 · 2 comments

Comments

@AndreyStille
Copy link

Hi I get
in utils/image.py
if (len(screenCnt) == 4):
screenCntList.append(screenCnt)
assert len(screenCntList) == 1
Please help me understand, what does it mean?
p.s. Thanks for your project

@tobiassteidle
Copy link
Owner

Hi,
please excuse my late reply.

Basically, in these lines, each contour (object) that is found is checked to see if it has 4 corners.
If it does, the 4 corners are stored together in an array.
This happens in:

if (len(screenCnt) == 4):
	screenCntList.append(screenCnt)

In this case it is assumed that there is only one "rectangle" on the image.
Therefore the check by assert len(screenCntList) == 1 whether it is really only one object.

I.e. screenCntList is to be seen basically as a multidimensional array in which the first dimension represents the object or the contour and in the second dimension the four corners.

Of course the whole thing is implemented only very rudimentary with a lot of optimism ;-)

@AndreyStille
Copy link
Author

Thanks for answer

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

2 participants