📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

SimpleLPR

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

SimpleLPR

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 return the detected license plate text and its location in the input image. It can be used from C++, .NET-enabled programming languages, or Python. Integration is simple and straightforward, as demonstrated by the examples provided with the SDK. 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 download the user's guide from https://www.warelogic.com/doc/SimpleLPR3.pdf, and the class reference for .NET from https://www.warelogic.com/doc/SimpleLPR.chm. Please submit questions/issues/bug reports/feedback to support@warelogic.com. Code example: using System; using System.Collections.Generic; using SimpleLPR3; // Create an instance of the SimpleLPR engine EngineSetupParms setupP; setupP.cudaDeviceId = -1; // Select CPU setupP.enableImageProcessingWithGPU = false; setupP.enableClassificationWithGPU = false; setupP.maxConcurrentImageProcessingOps = 0; // Use the default value // Create the SimpleLPR engine ISimpleLPR lpr = SimpleLPR.Setup(setupP); // Enable country templates for Brazil lpr.set_countryWeight("Brazil", 1.0f); lpr.set_countryWeight(countryId, 1.0f); // Create a processor object IProcessor proc = lpr.createProcessor(); // Use the analyze version that takes the path to a file List<Candidate> cds = proc.analyze("image.jpg"); // Iterate over all candidates foreach (Candidate cd in cds) { // Iterate over all country matches foreach (CountryMatch match in cd.matches) { Console.WriteLine("Text: {0}, country: {1}", match.text, match.country); } }

3.5.10
NuGet
Version published
Maintainers
3
Created
Source

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.

For further information, please download the user's guide and the class reference for .NET.

You can submit your questions/issues/bug reports/feedback to support@warelogic.com

Integration is simple and straightforward, as demonstrated in the following example:

using System;
using System.Collections.Generic;
using SimpleLPR3;

namespace TestSimpleLPR
{
    class Program
    {
    static void Main(string[] args)
    {
            // Create an instance of the SimpleLPR engine.
            EngineSetupParms setupP;
            setupP.cudaDeviceId = -1; // Select CPU
            setupP.enableImageProcessingWithGPU = false;
            setupP.enableClassificationWithGPU = false;
            setupP.maxConcurrentImageProcessingOps = 0;  // Use the default value.  

            ISimpleLPR lpr = SimpleLPR.Setup(setupP);

            // Output the version number
            VersionNumber ver = lpr.versionNumber;
            Console.WriteLine("SimpleLPR version {0}.{1}.{2}.{3}", ver.A, ver.B, ver.C, ver.D);

            try
            {
                bool bOk = (args.Length == 2 || args.Length == 3);
                if (bOk)
                {
                    string sFilePath = args[1];

                    // Configure country weights based on the selected country
                    uint countryId = uint.Parse(args[0]);

                    if (countryId >= lpr.numSupportedCountries)
                        throw new Exception("Invalid country id");

                    for (uint ui = 0; ui < lpr.numSupportedCountries; ++ui)
                        lpr.set_countryWeight(ui, 0.0f);

                    lpr.set_countryWeight(countryId, 1.0f);

                    lpr.realizeCountryWeights();

                    // Set the product key (if supplied)
                    if (args.Length == 3)
                        lpr.set_productKey(args[2]);

                    // Create a processor object
                    IProcessor proc = lpr.createProcessor();
                    proc.plateRegionDetectionEnabled = true;
                    proc.cropToPlateRegionEnabled = true;

                    // Use the analyze version that takes the path to a file
                    List<Candidate> cds = proc.analyze(sFilePath);

                    // Output the results
                    Console.WriteLine("***********");
                    Console.WriteLine("Results of IProcessor.analyze(file)");

                    if (cds.Count == 0)
                    {
                        Console.WriteLine("No license plate found");
                    }
                    else
                    {
                        Console.WriteLine("{0} license plate candidates found:", cds.Count);

                        // Iterate over all candidates
                        foreach (Candidate cd in cds)
                        {
                            Console.WriteLine("***********");
                            Console.WriteLine("Light background: {0}, left: {1}, top: {2}, width: {3}, height: {4}", cd.brightBackground, cd.bbox.Left, cd.bbox.Top, cd.bbox.Width, cd.bbox.Height);
                            Console.WriteLine("Plate confidence: {0}. Plate vertices: {1}", cd.plateDetectionConfidence, string.Join(", ", cd.plateRegionVertices));
                            Console.WriteLine("Matches:");

                            // Iterate over all country matches
                            foreach (CountryMatch match in cd.matches)
                            {
                                Console.WriteLine("-----------");
                                Console.WriteLine("Text: {0}, country: {1}, ISO: {2}, confidence: {3}", match.text, match.country, match.countryISO, match.confidence);
                                Console.WriteLine("Elements:");

                                foreach (Element e in match.elements)
                                {
                                    Console.WriteLine("   Glyph: {0}, confidence: {1}, left: {2}, top: {3}, width: {4}, height: {5}",
                                                      e.glyph, e.confidence, e.bbox.Left, e.bbox.Top, e.bbox.Width, e.bbox.Height);
                                }
                            }
                        }
                    }
                }
                else
                {
                    Console.WriteLine("\nUsage:  {0} <country id> <source file> [product key]", Environment.GetCommandLineArgs()[0]);
                    Console.WriteLine("    Parameters:");
                    Console.WriteLine("     country id: Country identifier. The allowed values are");

                    for (uint ui = 0; ui < lpr.numSupportedCountries; ++ui)
                        Console.WriteLine("\t\t\t{0}\t: {1}", ui, lpr.get_countryCode(ui));

                    Console.WriteLine("     source file: file containing the image to be processed");
                    Console.WriteLine("     product key:  product key file. this value is optional, if not provided SimpleLPR will run in evaluation mode");
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Exception occurred!: {0}", ex.Message);
            }
        }
    }
}

Keywords

LPR

FAQs

Package last updated on 04 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts