2

I tried python code with openalpr library to identify number plate. When I try to get plate number I got following error.

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!

This is a my code which I get from 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()

How to solve this error?

GPPK
  • 6,546
  • 4
  • 32
  • 57
user38701
  • 87
  • 2
  • 10

2 Answers2

1

Update the tesseract installation. Download Tesseract 3.04 from the below link

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

Test the version using

tesseract --version
0

you just need to update the tesseract and it will work it took me 2 hours to do it but my script works fine