我尝试使用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()
如何解决此错误?
答案 0 :(得分: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
答案 1 :(得分:0)
你只需更新tesseract就可以了,我花了2个小时才能完成它,但我的脚本运行正常