Preserving Spaces in Tesseract

醉酒当歌 提交于 2019-12-22 10:34:06

问题


I had an image file, which contain some text separated by tabs (2 spaces). But when I extract text out of this image file, I always get a single space between two columns. A sample example:

IMAGE:

col-a    col-b    col-c

Desired output:

col-a    col-b    col-c

But I am getting the following:

col-a col-b col-c

I am using pytesseract.image_to_string (Python module) convert image to text


回答1:


Use it like this:

pytesseract.image_to_string(img, config='-c preserve_interword_spaces=1')


来源:https://stackoverflow.com/questions/51668339/preserving-spaces-in-tesseract

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