Image Preprocessing for OCR - Tessaract

旧时模样 提交于 2019-12-05 18:08:31

You are right, tesseract works better with higher resolutions so sometimes resizing the image helps - but don't convert to 1 bit.

I got good results converting to grayscale, making it 3 times as large and making the letters a bit brighter:

>>> im = Image.open('j78TY.png')\
          .convert('L').resize([3 * _ for _ in im.size], Image.BICUBIC)\
          .point(lambda p: p > 75 and p + 100)
>>> pytesseract.image_to_string(im)
'NedNoodleArms'

Check this jupyter notebook:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!