Pytesseract太慢了.如何使其更快地处理图像?



我在下面的代码中使用了pytesseract:

def fnd():
for fname in list:
x = None
x = np.array([np.array(PIL.Image.open(fname))])
print x.size
for im in x:
txt = pytesseract.image_to_string(image=im).encode('utf-8').strip()
open("Output.txt","a+").write(txt)
with open("Output.txt") as openfile:                        
for line in openfile:
for part in line.split():
if "cyber" in part.lower():
print(line)
return

该列表包含文件夹中的图像名称(2408 * 3506和300 res 灰度(。不幸的是,对于大约 35 张图像,总处理时间约为 1400-1500 秒。

有没有办法减少处理时间?

Pytesseract写入并读取您传递的每个图像。运行 35 个映像时,这是不必要的。相反,您应该使用 python tesseract API 接口。这将明显更快。

最新更新