首页 > 解决方案 > 如何通过在python中使用pytesseract和opencv-python来识别其他更大对象下的变形文本?

问题描述

我正在使用 pytesseract 来识别如下文本

td = pytesseract.image_to_data(img, output_type=Output.DICT)
tn_boxes = len(td['level'])
for o in range(0, tn_boxes):
    text = td['text'][o]
    print(text)

我只是Examples通过使用一个简单的逻辑来制作索引detect keyword 'Example no.' find it's end point keyword 'Sol.' and put a piece of image from keyword 'Example no.' to keyword 'Sol.' into index and then find next example and so on
但是当我尝试跟随图像 上面没有线条的图像 然后它显示输出 SET THEORY ae . . 5 (6) Let A = {x: x isa negative odd integer} = {-1,-3,-5,-7,......等等
看看它是如何不识别第一行......等等Sol. (a) Let A={x:x is a natural number
当我尝试使用以下没有水平线的图像时, 上面没有线条的图像 它就可以正常工作。

有没有办法配置 pytesseract 来识别上面有一行的文本?

编辑:

有时,当我们将一些图像放在文本上方或其他一些尺寸较大的文本上时,pytesseract 无法检测到该较大对象下方的文本。

这种问题有什么解决方案吗?可能有一种方法可以配置检测最小尺寸或配置检测所有可能大小的文本,即使在一些更大的物体下?

例如它显示输出usually denoted by o(G). ors a a {= 7 Wave =e () oe that the set of ae | group usual ition of integers.
看看它是如何没有检测到Example 1. 以下图像的 关键字在此处输入图像描述

但是当我尝试下图时它显示输出usually denoted by o(G). Example 1. (2) Prove that th . group under usual addition of integers, 现在它正在检测关键字Example 1. 在此处输入图像描述

标签: opencvocrtesseractpython-tesseractopencv-python

解决方案



推荐阅读