无法使用pytesseract从.jpg图像中提取全文,只提取了部分具有拼写错误的文本

问题描述 投票:0回答:1

我正在尝试使用pytesseract从.jpg文件中提取数据,但只提取了部分文本,这些文本存在拼写错误。任何人都可以帮助建议我如何提取全文。我已附加.jpg作为您用于文本提取的参考代码段。

img=Image.open('page-594-5.jpg')
pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files/Tesseract-OCR/tesseract.exe'
text=pytesseract.image_to_string(img,lang='eng')

print(text)

我得到的输出:- enter image description here

需要从中提取数据的图像:-enter image description here

python ocr text-extraction python-tesseract
1个回答
0
投票

Pytesseract即使在印刷文本上也有其自身的局限性。尽管可以提高性能,但是您可以选择以下一些解决方案:

1)每个文本字符的大小(字体大小)约为12pt。

2)将图像分辨率设置为约300 DPI

setting image resolution

3)对图像进行消噪

denoising image using python

© www.soinside.com 2019 - 2024. All rights reserved.