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

cnts is None #1

Open
oceanpad opened this issue Feb 28, 2019 · 3 comments
Open

cnts is None #1

oceanpad opened this issue Feb 28, 2019 · 3 comments

Comments

@oceanpad
Copy link

File "code.py", line 45, in
for c in cnts:
TypeError: 'NoneType' object is not iterable

@DevashishPrasad
Copy link
Owner

This happens when find_contours is not able to find any find any contours resulting the cnts empty. Please make sure the image is processed properly. And also share the image

@siyangbing
Copy link

new = temp[0] + temp[1] + "." + temp[2]
IndexError: string index out of range

I use camera on the picture of your give ,can you help me?

@DevashishPrasad
Copy link
Owner

This happened because tesseract was not able to find any text to perform OCR in the image. Here are the things you can do -

  1. Try printing the contents of temp, and see what is actually being read by tesseract.
  2. Don't read my image from camera, give the program the image itself.
  3. Try seeing or printing the images (using cv2.imshow) after each step (after any filter, manipulation or changes you do to the image) for eg.
    - See the image after performing color masking (after line 27)
    - See the image after performing canny edge detection (after line 31)
    - See the image after performing dilate (after line 33)
    - See the image after performing erode (after line 35)
    - Try seeing images after all possible steps. Try assessing your results.

Your result should match with my results (my images which i have put in my readme.md)
In this way go on seeing the result of the program. Check that after line no. 56 are you able to see the digits clearly.

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

3 participants