首页 > 解决方案 > 许多图像的 tesseract 速度改进

问题描述

您对如何提高许多图像的 tesseract 速度有任何想法吗?我有2个例子。首先,我将图像转换为包含大约 200 个单词的文本。需要1 秒。其次,我有一个包含 2 个单词的 100 个图像的循环,需要16 秒。如何提高第二种情况的时间?

代码 1:

import pytesseract
from PIL import Image
patch = './pdf_2_jpg/image.jpg'
multi = Image.open(patch)
result = pytesseract.image_to_string(multi)

代码 2:

import pytesseract
from PIL import Image
patch = './pdf_2_jpg/image2.jpg'
single = Image.open(patch)
for x in range(100):
    result = pytesseract.image_to_string(single,lang='eng',config='--psm 6')

图像图像 2

标签: pythontesseractpython-tesseract

解决方案


推荐阅读