how to get character position in pytesseract

Chandy Alex picture Chandy Alex · Aug 24, 2015 · Viewed 8.5k times · Source

I am trying to get character position of image files using pytesseract library .

import pytesseract
from PIL import Image
print pytesseract.image_to_string(Image.open('5.png'))

Is there any library for getting each position of character

Answer

el Josso picture el Josso · Jun 6, 2017

Using pytesseract doesn't seem the best idea to have the position but you can do this :

from pytesseract import pytesseract
pytesseract.run_tesseract('image.png', 'output', lang=None, boxes=False, config="hocr")