【问题标题】:Openalpr directory errorOpenalpr 目录错误
【发布时间】:2015-09-18 08:41:58
【问题描述】:

我尝试使用带有 openalpr 库的 python 代码来识别车牌。当我尝试获取车牌号时,出现以下错误。

Warning: You are running an unsupported version of Tesseract.
Expecting at least 3.03, your version is: 3.02.02
Error opening data file /usr/local/share/tessdata/lus.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language 'lus'
Tesseract couldn't load any languages!

这是我从Here 获得的代码

from openalpr import Alpr

alpr = Alpr("us", "/etc/openalpr/openalpr.conf", "/home/pi/openalpr/runtime_data/")
if not alpr.is_loaded():
    print("Error loading OpenALPR")
    sys.exit(1)

alpr.set_top_n(20)
alpr.set_default_region("md")

results = alpr.recognize_file("/home/pi/ea7the.jpg")

i = 0
for plate in results['results']:
    i += 1
    print("Plate #%d" % i)
    print("   %12s %12s" % ("Plate", "Confidence"))
    for candidate in plate['candidates']:
        prefix = "-"
        if candidate['matches_template']:
            prefix = "*"

        print("  %s %12s%12f" % (prefix, candidate['plate'], candidate['confidence']))

# Call when completely done to release memory
alpr.unload()

如何解决这个错误?

【问题讨论】:

    标签: python linux openalpr


    【解决方案1】:

    更新 tesseract 安装。从以下链接下载 Tesseract 3.04

    wget -o tesseract https://github.com/tesseract-ocr/tesseract/archive/3.04.zip
    ./configure
    make 
    sudo make install
    sudo ldconfig
    

    使用测试版本

    tesseract --version
    

    【讨论】:

      【解决方案2】:

      你只需要更新 tesseract 就可以了,我花了 2 个小时才完成,但我的脚本运行良好

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-06-13
        • 1970-01-01
        • 2015-04-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多