modify last part of your code to this:

# invert image and convert to grayscale
inverted = PIL.ImageOps.invert(newim2).convert('LA')
loopTest = (pytesseract.image_to_string(
    inverted, config=tessdata_dir_config + '--psm 8 --oem 3'))
print(loopTest)
loopTest = int(loopTest)

Do not forget to import PIL and set up tessdata_dir_config as stated in
pytesseract docs[1].

[1] https://pypi.org/project/pytesseract/

Zdenko



ut 7. 5. 2019 o 15:09 Sean Connell <nightfire120sla...@gmail.com>
napĂ­sal(a):

> Thanks a bunch for the response. How would I go about inverting the image
> and increasing the contrast though. Sorry I'm still learning how all this
> works.
>
> --
> You received this message because you are subscribed to the Google Groups
> "tesseract-ocr" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tesseract-ocr+unsubscr...@googlegroups.com.
> To post to this group, send email to tesseract-ocr@googlegroups.com.
> Visit this group at https://groups.google.com/group/tesseract-ocr.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tesseract-ocr/3f937317-fe4b-4d92-af5e-96e169bb4df9%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tesseract-ocr+unsubscr...@googlegroups.com.
To post to this group, send email to tesseract-ocr@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8wqRJqmh8aqmepNkKj%2BvzBtb4YaerK7XeSZ7pR9r%2BNCVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to