简体   繁体   English

如何使用 Python 在一行中配置不同字体大小的 tesseract?

[英]How can I configure tesseract for different font sizes in one line with Python?

I have a problem that I get only the number 2201 from my image.我有一个问题,我从我的图像中只得到了数字 2201。 I have tried all configurations for pytesseract but no result.我已经尝试了 pytesseract 的所有配置,但没有结果。 Maybe somebody here has a solution for me?也许这里有人对我有解决方案? When I cut the image into two pieces and run the OCR it works perfectly.当我将图像切成两块并运行 OCR 时,它可以完美运行。

text = pytesseract.image_to_string(img, lang = 'deu', config='-psm 4')
print(text)

that was my configuration那是我的配置

Image being OCR'd图像被 OCR 处理

Problem is that it short text and it IS NOT on one (base)line.问题是它的文本很短,并且不在一个(基本)行上。 So you will need to split image to 2 part and OCR them separately.因此,您需要将图像拆分为 2 部分并分别对它们进行 OCR。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我怎样才能在 python 中制作这 9 个不同颜色和大小的不同球 - How can I make this 9 different balls with different colors and sizes in python python图中的不同字体大小 - Different font sizes in python plot matplotlib轴标签中可以有两种不同的字体大小吗? - Can I have two different font sizes in a matplotlib axes label? 如何使用 Python 将文本写入具有不同字体大小的文件? - How to write text into a file with different font-sizes using Python? Python Tesseract无法识别此字体 - Python Tesseract can't recognize this font PIL:我可以有多种大小的相同字体的文本吗? (Python) - PIL: can i have multiple sizes of text of the SAME font? (Python) 如何使用 Tesseract 训练基于 Python 的 OCR 以使用不同的国民身份证进行训练? - How can I train my Python based OCR with Tesseract to train with different National Identity Cards? PyQt5 - 我可以在 label 中文本的不同部分使用不同的字体大小吗? - PyQt5 - Can I use different font sizes on different parts of the text in a label? 如何为小部件创建不同的字体大小,但允许它们在PySide2中使用字体对话框缩放? - How do I create different font sizes for widgets but allow them to scale with font dialog in PySide2? Python:Matplotlib:如何在其中打印一个具有不同大小的文本? - Python: Matplotlib: how to print ONE text with different sizes in it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM