PyTesseract 缺少 = 在 configvar 赋值中

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

This is the code and the error I am receiving我正在尝试使用 OpenCV 和 PyTesseract 实现 ALPR 系统。当我尝试运行代码时,我收到此错误:

    Traceback (most recent call last):
  File "ocr.py", line 25, in <module>
    predictedResult = pytesseract.image_to_string(img, lang ='eng', config ='--oem 3 --psm 6 -c tessedit_char_whitelist = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
  File "/home/orhun/.local/lib/python3.8/site-packages/pytesseract/pytesseract.py", line 413, in image_to_string
    return {
  File "/home/orhun/.local/lib/python3.8/site-packages/pytesseract/pytesseract.py", line 416, in <lambda>
    Output.STRING: lambda: run_and_get_output(*args),
  File "/home/orhun/.local/lib/python3.8/site-packages/pytesseract/pytesseract.py", line 284, in run_and_get_output
    run_tesseract(**kwargs)
  File "/home/orhun/.local/lib/python3.8/site-packages/pytesseract/pytesseract.py", line 260, in run_tesseract
    raise TesseractError(proc.returncode, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, "read_params_file: Can't open = read_params_file: Can't open ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 Missing = in configvar assignment")

我可以做什么来解决这个问题?请帮忙!

python-tesseract
2个回答
3
投票

如果您遵循 www.geeksforgeeks.org 的教程,您可以更改 config 变量:

config ='--oem 3 --psm 6 -c tessedit_char_whitelist = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

至:

config ='--oem 3 --psm 7 -c tessedit_char_whitelist=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

我从 www.pyimagesearch.com 得到了这个解决方案。


0
投票

删除 = 左右两侧的空格
-->.....白名单=ABCD....

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