Skip to main content

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

SimpleLPR-3.5.6-cp311-cp311-win_amd64.whl (34.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

SimpleLPR-3.5.6-cp311-cp311-manylinux_2_31_x86_64.whl (94.5 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.31+ x86-64

SimpleLPR-3.5.6-cp310-cp310-win_amd64.whl (34.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

SimpleLPR-3.5.6-cp310-cp310-manylinux_2_31_x86_64.whl (94.5 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.31+ x86-64

SimpleLPR-3.5.6-cp39-cp39-win_amd64.whl (34.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

SimpleLPR-3.5.6-cp39-cp39-manylinux_2_31_x86_64.whl (94.5 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.31+ x86-64

SimpleLPR-3.5.6-cp38-cp38-win_amd64.whl (34.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

SimpleLPR-3.5.6-cp38-cp38-manylinux_2_31_x86_64.whl (94.5 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.31+ x86-64

File details

Details for the file SimpleLPR-3.5.6-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for SimpleLPR-3.5.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 93c97d1e8c9ddd388e6aa60e3e865d330d4844878e0c030a80b1e526eefe2521
MD5 ae4e7560cae5ff4a6e051a5467ebed69
BLAKE2b-256 7b898564f1652ae3f862fd89b4926efef022196bf3539212fe4f0cd051336bed

See more details on using hashes here.

File details

Details for the file SimpleLPR-3.5.6-cp311-cp311-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for SimpleLPR-3.5.6-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 720f1433c5e91d9c8b097de151a020ce1cf1b81564c39e5a8c7a76d631dcc898
MD5 1f07997a4ed1f642468ca8793c8be50c
BLAKE2b-256 5c2adbe2f8aced7f89cc95d4847ae9f36db7f50689f2fa193222b08b9939c1d1

See more details on using hashes here.

File details

Details for the file SimpleLPR-3.5.6-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for SimpleLPR-3.5.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b6f6dbdb654c88995c7c2538b5252bb9f2d940251fa112ec90deb6b941f637c8
MD5 937f296d406e73bd7f89d4fbf6740c5b
BLAKE2b-256 4af76e7bcf77ab22966fc807f4e3b03d87af5d9b6050823db15e89747ea23114

See more details on using hashes here.

File details

Details for the file SimpleLPR-3.5.6-cp310-cp310-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for SimpleLPR-3.5.6-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 311d6686aae846658dd8f292ac6a2599ef31055a6fa9efe492ab15aa7cce8cd0
MD5 40e2f7b23b58a753a1bd0e2d48039481
BLAKE2b-256 141cfae862d52f466c252563c1197734b3c52b74c531282263c0492c49c1b75d

See more details on using hashes here.

File details

Details for the file SimpleLPR-3.5.6-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: SimpleLPR-3.5.6-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 34.6 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

Hashes for SimpleLPR-3.5.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 66985825243f3ab5132f4dfb394a18d5a32db53d1ead3e5b44ecfc24d6dfc6da
MD5 1f0cee0648045d4d26b594399ed1b5af
BLAKE2b-256 393ddb3a028111f2cc3e14219a284fa2c94491bd6b3b5a56f77277877f03757d

See more details on using hashes here.

File details

Details for the file SimpleLPR-3.5.6-cp39-cp39-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for SimpleLPR-3.5.6-cp39-cp39-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 4fa7a6bf1fb0d6215f04d4870a9cbc8416485d86918ea5f704c0bc36de243643
MD5 ffeaa21bd30442f6ee3c3d612a07342c
BLAKE2b-256 07adb0e534e7e048b86c9b3b98f87d94199e0295e355e8618d710f0bf50c74da

See more details on using hashes here.

File details

Details for the file SimpleLPR-3.5.6-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: SimpleLPR-3.5.6-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 34.6 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

Hashes for SimpleLPR-3.5.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2126dfae8d12b4297ab437de3def49892961cbe01b8d8ec6a2a59ba5e0cab7e3
MD5 879478e1ff2f2c24e2f38ddcd5379945
BLAKE2b-256 f314f7797050d9dea1d7de5140acb4d2ee02ab7eefe1a756dfd8c2ea18755f25

See more details on using hashes here.

File details

Details for the file SimpleLPR-3.5.6-cp38-cp38-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for SimpleLPR-3.5.6-cp38-cp38-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 496fa856ac01a4f15a4a5fe93831f54048bb987002fe357f6937d1dd07338620
MD5 2714f107c4203d251e99617a19dba0f4
BLAKE2b-256 e9df8ec9fa7ff18c366c8835660c26e89ba4caf8c38bcd500448f5e29b20ac77

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page