如果使用配置tessedit_char_whitelist,则pyteseract image_to_data信心结果无法正常工作

发布于 2025-02-12 19:21:30 字数 885 浏览 4 评论 0原文

我使用的是Pytesseract 5.0.1.20220118,带有Python 3.9.7,需要从具有某些白色列表条件的车牌中检测文本,并获得每个检测的信心:

pt.image_to_data(roi,lang ='eng', config="--psm 6",  output_type='data.frame')

在此图像上:

[”在此处输入图像描述]

我将获得以下输出:

conf文本
-1.000000 nan
-1.000000 nan
-1.000000 nan
-1.000000 nan
92.998444 b
95.961960 708569
96.753922 |

但是,“ |”角色不是允许的角色,所以我添加了一个白名单:

pt.image_to_data(roi,lang ='eng', config="--psm 6 -c tessedit_char_whitelist=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",  output_type='data.frame')

我得到了:

conf文本
-1.0 nan
-1.0 nan
-1.0 nan
-1.0 nan
0.0 B708​​569]

但是现在检测的信心是错误的。我该如何解决?

I am using pytesseract 5.0.1.20220118 with python 3.9.7 and need to detect text from a license plate with certain white list conditions and get the confidence for each detection:

pt.image_to_data(roi,lang ='eng', config="--psm 6",  output_type='data.frame')

On this image:

[enter image description here]

I get the following output:

conf text
-1.000000 NaN
-1.000000 NaN
-1.000000 NaN
-1.000000 NaN
92.998444 B
95.961960 708569
96.753922 |

However, the "|" character is not an allowed character so I added a whitelist:

pt.image_to_data(roi,lang ='eng', config="--psm 6 -c tessedit_char_whitelist=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",  output_type='data.frame')

And I got:

conf text
-1.0 NaN
-1.0 NaN
-1.0 NaN
-1.0 NaN
0.0 B708569]

But now the confidence of the detections is wrong. How can I fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文