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

UnboundLocalError: local variable 'screenCnt' referenced before assignment #1

Open
zenners opened this issue Oct 2, 2017 · 1 comment

Comments

@zenners
Copy link
Owner

zenners commented Oct 2, 2017

[2017-10-02 16:53:56,762] ERROR in app: Exception on / [POST]
warped = four_point_transform(orig, screenCnt.reshape(4, 2) * ratio)
UnboundLocalError: local variable 'screenCnt' referenced before assignment

for c in cnts:
    	# approximate the contour
    	peri = cv2.arcLength(c, True)
    	approx = cv2.approxPolyDP(c, 0.02 * peri, True)

    	# if our approximated contour has four points, then we
    	# can assume that we have found our screen
    	if len(approx) == 4:
    		screenCnt = approx
    		break

    print ("STEP 2: Find contours of paper")
    warped = four_point_transform(orig, screenCnt.reshape(4, 2) * ratio)
@zenners
Copy link
Owner Author

zenners commented Oct 2, 2017

Happens when a rectangle cant be form from the image. Maybe the edges aren't clear or are folded

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