如何在python中使用pytesseract和opencv-python识别其他较大对象下的变形文本?

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

我正在使用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但是当我尝试跟随图像时image without line above it然后显示输出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 .. etc。当我尝试以下图像没有水平线时image without line above it它很好用。

有什么方法可以配置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.跟随图像enter image description here

但是当我尝试跟随图像时它显示输出usually denoted by o(G). Example 1. (2) Prove that th . group under usual addition of integers,现在它正在检测关键字Example 1.enter image description here

opencv ocr tesseract python-tesseract opencv-python
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.