首页 > 解决方案 > Tesseract 不返回任何阿拉伯语单词/字母

问题描述

我已经安装了 Pytesseract,它在法语/英语文本和数字上都能完美运行。但是当我尝试阅读任何阿拉伯语文本/字母时,它不会返回任何内容。

这是我使用的代码:

try:
    from PIL import Image
except ImportError:
    import Image
import pytesseract

pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files (x86)\Tesseract-OCR\tesseract.exe"

print(pytesseract.image_to_string(Image.open('maroc.jpg'), lang='ara'))

这是我要读的信د

د

如果有人能够使用其他方法阅读它,请帮助,谢谢!

标签: ocrtesseractarabic

解决方案


代码 :

from pytesseract import image_to_string 
from PIL import Image
import pytesseract

print(pytesseract.image_to_pdf_or_hocr('test.png', lang='ara', extension='hocr'))

从这里获取新的阿拉伯语 tessdata :


推荐阅读