SimpleLPR License Plate Recognition (LPR/ANPR) library.
Project description
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 the SimpleLPR extension.
import simplelpr
# Lists all available countries.
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):
# Enables syntax verification with the selected country.
eng.set_countryWeight(country_id, 1)
eng.realizeCountryWeights()
# If provided, supplies the product key as a file.
if key_path is not None:
eng.set_productKey(key_path)
# Alternatively, it could also be supplied from a buffer in memory:
#
# with open(key_path, mode='rb') as file:
# key_content = file.read()
# eng.set_productKey( key_content )
# Create a Processor object. Every working thread should use its own processor.
proc = eng.createProcessor()
# Enable the plate region detection and crop to plate region features.
proc.plateRegionDetectionEnabled = True
proc.cropToPlateRegionEnabled = True
# Looks for license plate candidates in an image in the file system.
cds = proc.analyze(img_path)
# Alternatively, the input image can be supplied through an object supporting the buffer protocol:
#
# fh = open(img_path, 'rb')
# try:
# ba = bytearray(fh.read())
# finally:
# fh.close()
# cds = proc.analyze(ba)
#
# or
#
# import numpy as np
# from PIL import Image
#
# im = Image.open(img_path)
# npi = np.asarray(im)
# cds = proc.analyze(npi)
#
# or
#
# import cv2
#
# im = cv2.imread(img_path)
# cds = proc.analyze(im)
# Show the detection results.
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:
# The simplelpr extension requires 64-bit Python 3.8 or 3.9
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')
# Create a SimpleLPR engine.
setupP = simplelpr.EngineSetupParms()
eng = simplelpr.SimpleLPR(setupP)
print("SimpleLPR version:",
"{:}.{:}.{:}.{:}".format(eng.versionNumber.A, eng.versionNumber.B, eng.versionNumber.C,
eng.versionNumber.D))
# Parse the command line arguments.
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.
list_countries(eng)
elif args.command == 'analyze':
# Analyze an image in the file system.
analyze_file(eng, args.country_id, args.img_path, args.key_path)
else:
# Shouldn't occur.
raise RuntimeError('Unknown command')
except Exception as e:
print('An exception occurred: {}'.format(e))
if __name__ == '__main__':
main()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file SimpleLPR-3.5.5-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: SimpleLPR-3.5.5-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 34.5 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e2a5d7f4fb26063df7563e2d0bbd0f849f2eb4a75aa009c8b3d5d9394bc0f59 |
|
MD5 | 2222f23400beb3617d801d149b92a4a7 |
|
BLAKE2b-256 | 78689c11338df36de45ea0f8f8920c22c185439f6dafe3147a3acb1d82d8c016 |
File details
Details for the file SimpleLPR-3.5.5-cp311-cp311-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: SimpleLPR-3.5.5-cp311-cp311-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 94.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9a1d0a5ff1c573e7e12265183678fdec09fc9c6eeb746aaa3b627288c48ddac |
|
MD5 | 35148dc8901b54badb836db544d7ed55 |
|
BLAKE2b-256 | 387b6f1445b65e6c94f287cca87b315258221fa5a0b058d091f05dd96d717fd1 |
File details
Details for the file SimpleLPR-3.5.5-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: SimpleLPR-3.5.5-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 34.5 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7ce704c9da8e5c51281177f2c07659b6ee87e9c3d5b87c10597e1a981e8d7d4 |
|
MD5 | 3efd3360393bc9a58f553eafa7bf6c49 |
|
BLAKE2b-256 | 523336e88e361a6fb5c67158e5f263cc5364326c4c6bb8dd4a5173d8cdb0556f |
File details
Details for the file SimpleLPR-3.5.5-cp310-cp310-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: SimpleLPR-3.5.5-cp310-cp310-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 94.5 MB
- Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ff2928d129e01f6cdf73b6debed23f07cbc1d46adb33fbff21c284981343a36 |
|
MD5 | 94330df6b5dd4fefb0211ff5171a8a68 |
|
BLAKE2b-256 | 5cd7fcff277447475f529930a5d9e8b620aaa37a8a8e30fbdfb1bc4128a07ee8 |
File details
Details for the file SimpleLPR-3.5.5-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: SimpleLPR-3.5.5-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 34.5 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e09aa130d32a692a43e479ed292994c24d2b8c3a8900bfbcec802adbfb15b45 |
|
MD5 | bca63b145967f7575df129aeb777c441 |
|
BLAKE2b-256 | 1c572af4243293596ee0997cb63dd734c5284cbc860721ce7fe4e840ead084b6 |
File details
Details for the file SimpleLPR-3.5.5-cp39-cp39-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: SimpleLPR-3.5.5-cp39-cp39-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 94.5 MB
- Tags: CPython 3.9, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa75d1e93d29d5695aa3503d908ce559cca02f126e4906a24e97028a3f980ad0 |
|
MD5 | ebb6d188f92fb8cd543b7003cb09f27b |
|
BLAKE2b-256 | 098aa2733aaee2cf63e2bb92cb3db1b9c219b8d584c08ef717a6faf34397e805 |
File details
Details for the file SimpleLPR-3.5.5-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: SimpleLPR-3.5.5-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 34.5 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee7c20c5fc4a00e44eaa0c45c2a77bae1fb038c9a33ceecc93928f861a15db3c |
|
MD5 | 865f1e69fdfc64499a0ad96428281ead |
|
BLAKE2b-256 | dafbf7ca237f3814be952d4f493fb60a5fe7e09fa4ca74cb31999946db5bc857 |
File details
Details for the file SimpleLPR-3.5.5-cp38-cp38-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: SimpleLPR-3.5.5-cp38-cp38-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 94.5 MB
- Tags: CPython 3.8, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94b7f47d8047352b62091fdbd93161b65d1d773dc03a48853555b3fd330c33c8 |
|
MD5 | fad24ab4158575784efd151c18083866 |
|
BLAKE2b-256 | cf751cb1953fb8a7e65bf3db1965ad267ea16a57ed2fba38f8a07d649bbc46e7 |