【问题标题】:set white list in python tesserocr pkg在 python tesserocr pkg 中设置白名单
【发布时间】:2018-08-20 11:34:36
【问题描述】:

我在 tessdata 中创建了一个配置文件来设置白名单。而且我也知道如何在命令行 shell 中使用它。但我不知道如何在带有 tesserocr 包的 python 中使用它。函数tesserocr.image_to_text() 似乎没有白名单参数。

【问题讨论】:

  • 请提供问题的最小完整示例。
  • @AndriyIvaneyko 措辞有点粗糙,但我认为这个问题不需要minimal reproducible example - OP 正在询问如何在 Python 包中创建白名单,tesserocr,因为他们知道没有 Python 也是可能的。
  • @kabanus 谢谢,有道理

标签: python tesseract whitelist


【解决方案1】:

好像image_to_text不接受白名单参数,请使用SetVariable,看下面tesseroct base api上设置白名单的解决方案:

api = tesserocr.PyTessBaseAPI()
api.ReadConfigFile('digits')
# Consider having string with the white list chars in the config_file, for instance: "0123456789"
while_list = open(config_file_path).read()
api.SetVariable("tessedit_char_whitelist", while_list)

【讨论】:

    猜你喜欢
    • 2011-09-19
    • 2016-12-28
    • 2017-09-28
    • 2012-10-22
    • 2022-06-26
    • 2020-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多