SimpleLPR is a software component for vehicle license plate recognition. It has a very simple programming interface that allows applications to supply a path to an image or a buffer in memory and returns the detected license plate text and its location in the input image. It can be used from C++, .NET-enabled programming languages, or Python.
Typical detection rates range between 85% and 95%, provided the license plates are in good condition, free of obstructions, and the text height is at least 20 pixels.
You can submit your questions/issues/bug reports/feedback to support@warelogic.com
Integration is simple and straightforward, as demonstrated in the following example:
import sys, os, argparse
import simplelpr
def list_countries(eng):
print('List of available countries:')
for i in range(0, eng.numSupportedCountries):
print(eng.get_countryCode(i))
def analyze_file(eng, country_id, img_path, key_path):
eng.set_countryWeight(country_id, 1)
eng.realizeCountryWeights()
if key_path is not None:
eng.set_productKey(key_path)
proc = eng.createProcessor()
proc.plateRegionDetectionEnabled = True
proc.cropToPlateRegionEnabled = True
cds = proc.analyze(img_path)
print('Number of detected candidates:', len(cds))
for cand in cds:
print('-----------------------------')
print('darkOnLight:', cand.darkOnLight, ', plateDetectionConfidence:', cand.plateDetectionConfidence)
print('boundingBox:', cand.boundingBox)
print('plateRegionVertices:', cand.plateRegionVertices)
for cm in cand.matches:
print('\tcountry:', "'{:}'".format(cm.country), ', countryISO:', "'{:}'".format(cm.countryISO),
', text:', "'{:}'".format(cm.text), ', confidence:', '{:.3f}'.format(cm.confidence))
for e in cm.elements:
print('\t\tglyph:', "'{:}'".format(e.glyph), ', confidence:', '{:.3f}'.format(e.confidence),
', boundingBox:', e.boundingBox)
def main():
try:
if sys.version_info[0:2] != (3, 8) and sys.version_info[0:2] != (3, 9):
raise RuntimeError('This demo requires either Python 3.8 or 3.9')
if len(sys.argv) == 1:
sys.argv.append('--help')
setupP = simplelpr.EngineSetupParms()
eng = simplelpr.SimpleLPR(setupP)
print("SimpleLPR version:",
"{:}.{:}.{:}.{:}".format(eng.versionNumber.A, eng.versionNumber.B, eng.versionNumber.C,
eng.versionNumber.D))
parser = argparse.ArgumentParser(description='SimpleLPR on Python demo application')
subparsers = parser.add_subparsers(dest='command', help='Sub-command help')
subparsers.add_parser('list', help='List all available countries')
parser_analyze = subparsers.add_parser('analyze', help='Looks for license plate candidates in an image')
parser_analyze.add_argument('country_id', type=str, help='Country string identifier')
parser_analyze.add_argument('img_path', type=str, help='Path to the image file')
parser_analyze.add_argument('key_path',
type=str,
nargs='?',
help="Path to the registration key file. In case you need to extend the 60-day "
"evaluation period you can send an e-mail to 'support@warelogic.com' to "
"request a trial key")
args = parser.parse_args()
if args.command == 'list':
list_countries(eng)
elif args.command == 'analyze':
analyze_file(eng, args.country_id, args.img_path, args.key_path)
else:
raise RuntimeError('Unknown command')
except Exception as e:
print('An exception occurred: {}'.format(e))
if __name__ == '__main__':
main()