如何获取从 pytesseract.image_to_boxes 中提取文本的置信度

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

我使用 pytesseract.image_to_boxes 因为我需要从文本中提取所有细节,但我需要在字符级别。我获得了字符的文本、左、下、右、上和页。但我也需要信心,这个功能好像没有提供。

我知道我也可以使用 image_to_data 来获得置信度,但这是针对整个单词给出的,我需要分别为每个字符提供它。有什么方法可以获取吗

示例:

字符串输入:

img = 168

pytesseract.image_to_boxes(img, output_type=pytesseract.Output.DICT)

我得到了什么:

{'char': ['1', '6', '8'], 
'left': [15, 87, 177], 
'bottom': [0, 0, 0], 
'right': [66, 162, 252], 
'top': [136, 135, 135], 
'page': [0, 0, 0]}

想要的结果:

{'char': ['1', '6', '8'], 
**'conf': [99.99, 87.86, 78.55],**
'left': [15, 87, 177], 
'bottom': [0, 0, 0], 
'right': [66, 162, 252], 
'top': [136, 135, 135], 
'page': [0, 0, 0]}
python python-tesseract
1个回答
0
投票

你找到解决办法了吗?我也面临着同样的问题。

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