python - 许多图像的 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')
解决方案
推荐阅读
- python - 将数据帧转换为 3D 张量(具有多个特征)
- c# - 从 c# 调用 Octave 命令的问题
- django - 在 Django 中将 ProhibitNullCharactersValidator 动态添加到表单的 __init__ 中。需要一个建议
- swift - 使用 Apple Watch 进行振动检测
- excel - 使用开关的问题
- android - ConstraintLayout 中的百分比和权重不起作用
- delphi - 将第 3 方 obj 文件编译为 64 位 Delphi 应用程序 - 异常帧问题
- python - 如何处理启用电报机器人的错误?
- c# - 如何使用 ZXing [ASP.Net WebForm] 直接从手机摄像头读取二维码
- php - Laravel 旧方法不返回密码值