2

我尝试了带有 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!

这是我从这里得到的代码

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()

如何解决这个错误?

4

2 回答 2

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
于 2019-04-25T18:51:47.767 回答
0

你只需要更新 tesseract 就可以了,我花了 2 个小时才完成,但我的脚本工作正常

于 2016-04-21T09:27:58.653 回答