似乎是这样 image_to_text 不接受白名单参数,请使用 SetVariable 为此,请参阅下面tesseroct base api上设置白名单的解决方案:
SetVariable
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)