DevashishPrasad / LCD-OCR

This is a tesseract based OCR to read from seven segment display.
42 stars 11 forks source link

cnts is None #1

Open oceanpad opened 5 years ago

oceanpad commented 5 years ago

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

DevashishPrasad commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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.

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.