我尝试了带有 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()
如何解决这个错误?