ocr - 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'))
这是我要读的信د
:
如果有人能够使用其他方法阅读它,请帮助,谢谢!
解决方案
代码 :
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 :
推荐阅读
- python - 在 Python 中转换为数据框时,列值变为 Nan
- html - 从两行开始的文本溢出
- javascript - Why does AJAX (reload div every x time) not work?
- arrays - Gnuplot:是否可以使用 for 循环将变量存储在数组中?
- laravel - 无法安装ui包
- bash - 如何计算bash脚本中多行变量中单词的出现次数
- javascript - setInterval 不会执行内部函数
- java - 我遇到的问题是@cacheable同步属性没有生效
- flutter - 如何将 TextDirection 设置为颤振主题
- ios - 将所有从“Firebase 推送通知”接收的消息存储在移动数据库/本地