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.7-cp312-cp312-win_amd64.whl (34.3 MB view details)

Uploaded CPython 3.12 Windows x86-64

SimpleLPR-3.5.7-cp312-cp312-manylinux_2_31_x86_64.whl (93.9 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.31+ x86-64

SimpleLPR-3.5.7-cp311-cp311-win_amd64.whl (34.3 MB view details)

Uploaded CPython 3.11 Windows x86-64

SimpleLPR-3.5.7-cp311-cp311-manylinux_2_31_x86_64.whl (93.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.31+ x86-64

SimpleLPR-3.5.7-cp310-cp310-win_amd64.whl (34.3 MB view details)

Uploaded CPython 3.10 Windows x86-64

SimpleLPR-3.5.7-cp310-cp310-manylinux_2_31_x86_64.whl (93.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.31+ x86-64

SimpleLPR-3.5.7-cp39-cp39-win_amd64.whl (34.3 MB view details)

Uploaded CPython 3.9 Windows x86-64

SimpleLPR-3.5.7-cp39-cp39-manylinux_2_31_x86_64.whl (93.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.31+ x86-64

SimpleLPR-3.5.7-cp38-cp38-win_amd64.whl (34.3 MB view details)

Uploaded CPython 3.8 Windows x86-64

SimpleLPR-3.5.7-cp38-cp38-manylinux_2_31_x86_64.whl (93.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.31+ x86-64

File details

Details for the file SimpleLPR-3.5.7-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for SimpleLPR-3.5.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 38b9e07baaa88461f3bd8713d7e1c876a1a4638b8aca6400d1d2e80ff6ae2e5f
MD5 6465e4f825c85a0cde537801f0557c22
BLAKE2b-256 cafaa4636897666d1b8c8680f6fe74cd647eeec436165a47b5f35225967ab598

See more details on using hashes here.

File details

Details for the file SimpleLPR-3.5.7-cp312-cp312-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for SimpleLPR-3.5.7-cp312-cp312-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 197035b4733b46dcdb63658ec3b5193ef64e56335af9b9379e5d176d6bd98fde
MD5 08e2d0d785c34efbb0aa9604ffa9d47a
BLAKE2b-256 df922bc831f84d69a78d9837269ffea3f89652768c50001802e1c82b5a0bbc2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SimpleLPR-3.5.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b9eb5214d14936b4433f696cf675e53d731e4e6ef715c7552310194d1e2e89f4
MD5 58d2a37cc80635767c3821e495b9b359
BLAKE2b-256 4c19b3f9b54de9b973b5de8d4ac5cebc7bc4567dfa72f1ea9e59868b80704ad6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SimpleLPR-3.5.7-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 cc99cd36f7beca6c00210906e4a2a0d715ffe17cb88e5f45bb1633ea75a6fee2
MD5 0aa4e537c2ddc0e0637cb53c7e2f4465
BLAKE2b-256 498d0d2129f62a39ce87860066beb8606ead9a193c251811b3d2c099260d17bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SimpleLPR-3.5.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f6553d76178704a2226221286a6370c67a91820f979184bf07aa03ecb5ec6d3b
MD5 3dfc4da2642df84854bf2a7947ce401b
BLAKE2b-256 7ddbd5848c084c47b5ce787ba345ecf953872fffc998323eaed902076deaf5f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SimpleLPR-3.5.7-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 091a0d31000cffa22bebc2a5ff8feaca34046f93d70c69b62737fdf6323f98bd
MD5 274985f76f1f5de18249073438d21d42
BLAKE2b-256 8cef24dc2cd17c6772d042715ac157589ed11da7a4a2c32eee32a81d707f59c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SimpleLPR-3.5.7-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 34.3 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for SimpleLPR-3.5.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b94712dd62216564bdae63b90af44c94bae88100b4d30b44f809485f30b92cc6
MD5 3a2b00a7bd7d3505ffc106ca2f370ee5
BLAKE2b-256 2440cc0ac923ffffe148215d09b93c98762651301d552caa1030728887cb2940

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SimpleLPR-3.5.7-cp39-cp39-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 ca076e1bd45d458ee09edf65a21c210b4a2d0cd90f42be09471b6b692f3a1f1a
MD5 1b4e59efe814cd3e5ebd2cdc5baa704a
BLAKE2b-256 591d1b1c4c31fa55ca66cce5bd1c7fd6fdf953249abd45766560dd5f4fe6a225

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SimpleLPR-3.5.7-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 34.3 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for SimpleLPR-3.5.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e55a147384ac9a308260a5cd21ff732462c8b079f8d7bae99b54e89f870d8a61
MD5 4e8a8ab6d2e9df0f5235112b8d2eed4b
BLAKE2b-256 df7ff790edd5f43e16a4bb04ac585e563d54b48d6fdd047c484403d6413dcb1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for SimpleLPR-3.5.7-cp38-cp38-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 68a7e43be52554a248c48a7d2b6538e9686390424daad105e13d078b91f64acd
MD5 849583966cc1c0f25c20eb6478dfac3f
BLAKE2b-256 b1ab6583cfb98e8165e1c74851640f0f7a22788f64b145c51c20ef30a19d2524

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