How to Read License Plates in C# OCR

How to Read License Plates in C# with IronOCR

IronOCR's ReadLicensePlate method automatically extracts license plate numbers from vehicle images using advanced OCR technology. This single method call can process license plates with high accuracy, returning both the plate text and confidence score for automated vehicle management systems.

When managing a large volume of vehicle images, manually reading license plates is time-consuming and prone to human error. Automating this process with a tool like IronOCR provides a more efficient, accurate solution. IronOCR's ReadLicensePlate method can programmatically extract the license plate numbers from images, saving considerable time while improving data accuracy.

In this guide, we'll demonstrate how to use IronOCR for license plate recognition, walking through examples and customizable configurations that make the process seamless. By leveraging these methods, developers can automate license plate reading, making tasks like parking management, toll collection, or security surveillance more efficient.

To use this function, you must also install the IronOcr.Extension.AdvancedScan package.

Quickstart: Extract License Plate Number Instantly

With a single method call using IronOCR's ReadLicensePlate, you can programmatically extract the license plate text from any image. It's ready to use—just load an image, call the method, and get both the plate number and confidence right away.

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronOCR with NuGet Package Manager

    PM > Install-Package IronOcr

  2. Copy and run this code snippet.

    OcrLicensePlateResult result = new IronTesseract().ReadLicensePlate(new OcrInput("plate.jpg"));
  3. Deploy to test on your live environment

    Start using IronOCR in your project today with a free trial
    arrow pointer

How Do I Read a License Plate in C#?

To read a license plate in IronOCR, we apply the following steps:

  • We utilize the ReadLicensePlate method, which takes an OcrInput as a parameter for the input. This method is more optimized for license plates than the library's standard Read counterpart.
  • Optionally, we can configure IronOCR to whitelist specific characters that can exist in a license plate, to speed up the license plate number processing.

Please note

  • The method currently only works for English, Chinese, Japanese, Korean, and Latin alphabet scripts.
  • Using advanced scan on .NET Framework requires the project to run on x64 architecture.

What Does the Input License Plate Look Like?

California license plate showing '8TRS777' - example for license plate reading demonstration

How Do I Configure the OCR for License Plates?

:path=/static-assets/ocr/content-code-examples/how-to/read-license-plate-read-license-plate.cs
using IronOcr;
using System;

var ocr = new IronTesseract();
ocr.Configuration.WhiteListCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";

using var inputLicensePlate = new OcrInput();
inputLicensePlate.LoadImage("plate.jpeg");

// Read license plate
OcrLicensePlateResult result = ocr.ReadLicensePlate(inputLicensePlate);

// Retrieve license plate number and confidence value
string output = $"{result.Text}\nResult Confidence: {result.Confidence}";

Console.WriteLine(output);
$vbLabelText   $csharpLabel

What Results Should I Expect?

Debug console showing license plate OCR results: California state, plate 8TRS777, confidence 95.87%

The code demonstrates how to import an image as an OcrInput and use it with the ReadLicensePlate method to extract the text from the license plate. The output shows the extracted text that matches the license plate shown in the input image, along with a confidence level indicating the accuracy of the OCR.

Text: The extracted text from OCR Input.

Confidence: A double property that indicates the statistical accuracy confidence of an average of every character, with one being the highest and 0 being the lowest.

For more precise control over the OCR process, you can explore advanced configuration options to fine-tune character recognition settings.


How Can I Extract License Plates From Car Images?

The method also works well with images containing a car with a license plate. The code is the same as the one above, with the input image changed. You can also extract the pixel coordinates of the area where the license plate is situated in the image.

What Type of Car Images Work Best?

Dark gray Skoda car showing Maharashtra license plate MH 20 EE 7602 parked on brick pavement

For optimal results, ensure your car images have:

  • Clear visibility of the license plate
  • Good lighting conditions (avoid glare or shadows)
  • Minimal angle distortion
  • Adequate resolution (consider adjusting DPI settings for low-resolution images)

How Do I Get the License Plate Location Coordinates?

:path=/static-assets/ocr/content-code-examples/how-to/read-license-plate-read-from-car.cs
using IronOcr;
using IronSoftware.Drawing;
using System;

var ocr = new IronTesseract();
using var inputLicensePlate = new OcrInput();
inputLicensePlate.LoadImage("car_license.jpg");

// Read license plate
OcrLicensePlateResult result = ocr.ReadLicensePlate(inputLicensePlate);

// Retrieve license plate coordinates
RectangleF rectangle = result.Licenseplate;

// Write license plate value and coordinates in a string
string output = $"License Plate Number:\n{result.Text}\n\n"
              + $"License Plate Area_\n"
              + $"Starting X: {rectangle.X}\n"
              + $"Starting Y: {rectangle.Y}\n"
              + $"Width: {rectangle.Width}\n"
              + $"Height: {rectangle.Height}";

Console.WriteLine(output);
$vbLabelText   $csharpLabel

What Information Does the Result Include?

Visual Studio debug output showing detected license plate MH20EE7602 with bounding box coordinates and dimensions

The example shows how the ReadLicensePlate method can be applied to an image of a car. The method will also return the rectangle coordinates of where the license plate is situated in the image.

This method is optimized to find single license plates only and is capable of searching for them in stock images.

How Do I Process Multiple License Plates?

When dealing with multiple vehicle images, you can process them efficiently using batch operations:

using IronOcr;
using System.IO;
using System.Threading.Tasks;

public async Task ProcessMultipleLicensePlates(string[] imagePaths)
{
    var ocr = new IronTesseract();

    // Configure for optimal performance
    ocr.Configuration.WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock;

    var tasks = imagePaths.Select(async path => 
    {
        using var input = new OcrInput();
        input.LoadImage(path);

        var result = await Task.Run(() => ocr.ReadLicensePlate(input));

        return new { 
            FilePath = path, 
            PlateNumber = result.Text, 
            Confidence = result.Confidence 
        };
    });

    var results = await Task.WhenAll(tasks);

    // Process results
    foreach (var result in results)
    {
        Console.WriteLine($"File: {result.FilePath}");
        Console.WriteLine($"Plate: {result.PlateNumber} (Confidence: {result.Confidence:P})");
    }
}
using IronOcr;
using System.IO;
using System.Threading.Tasks;

public async Task ProcessMultipleLicensePlates(string[] imagePaths)
{
    var ocr = new IronTesseract();

    // Configure for optimal performance
    ocr.Configuration.WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock;

    var tasks = imagePaths.Select(async path => 
    {
        using var input = new OcrInput();
        input.LoadImage(path);

        var result = await Task.Run(() => ocr.ReadLicensePlate(input));

        return new { 
            FilePath = path, 
            PlateNumber = result.Text, 
            Confidence = result.Confidence 
        };
    });

    var results = await Task.WhenAll(tasks);

    // Process results
    foreach (var result in results)
    {
        Console.WriteLine($"File: {result.FilePath}");
        Console.WriteLine($"Plate: {result.PlateNumber} (Confidence: {result.Confidence:P})");
    }
}
$vbLabelText   $csharpLabel

For large-scale processing, consider implementing multithreading capabilities to maximize performance.

How Can I Improve License Plate Recognition Accuracy?

To enhance the accuracy of license plate detection, consider these optimization techniques:

Apply Image Preprocessing Filters

using IronOcr;

var ocr = new IronTesseract();
using var input = new OcrInput();

// Load and preprocess the image
input.LoadImage("blurry_plate.jpg");
input.Deskew();  // Correct image rotation
input.DeNoise(); // Remove background noise
input.EnhanceResolution(225); // Upscale for better clarity
input.Sharpen(); // Enhance edge definition

var result = ocr.ReadLicensePlate(input);
using IronOcr;

var ocr = new IronTesseract();
using var input = new OcrInput();

// Load and preprocess the image
input.LoadImage("blurry_plate.jpg");
input.Deskew();  // Correct image rotation
input.DeNoise(); // Remove background noise
input.EnhanceResolution(225); // Upscale for better clarity
input.Sharpen(); // Enhance edge definition

var result = ocr.ReadLicensePlate(input);
$vbLabelText   $csharpLabel

Learn more about available image filters and image correction techniques to optimize your input images.

Handle Different Lighting Conditions

For challenging lighting scenarios, apply appropriate corrections:

using IronOcr;

var ocr = new IronTesseract();
using var input = new OcrInput();

input.LoadImage("dark_plate.jpg");
input.Contrast(1.5); // Increase contrast
input.Brightness(1.2); // Adjust brightness
input.Binarize(); // Convert to black and white for clarity

var result = ocr.ReadLicensePlate(input);
using IronOcr;

var ocr = new IronTesseract();
using var input = new OcrInput();

input.LoadImage("dark_plate.jpg");
input.Contrast(1.5); // Increase contrast
input.Brightness(1.2); // Adjust brightness
input.Binarize(); // Convert to black and white for clarity

var result = ocr.ReadLicensePlate(input);
$vbLabelText   $csharpLabel

How Do I Monitor OCR Performance?

When processing large batches of license plates, tracking progress helps manage system resources:

using IronOcr;

var ocr = new IronTesseract();

// Subscribe to progress events
ocr.OcrProgress += (sender, e) => 
{
    Console.WriteLine($"Processing: {e.ProgressPercent}% complete");
};

using var input = new OcrInput();
input.LoadImage("large_parking_lot.jpg");

var result = ocr.ReadLicensePlate(input);
using IronOcr;

var ocr = new IronTesseract();

// Subscribe to progress events
ocr.OcrProgress += (sender, e) => 
{
    Console.WriteLine($"Processing: {e.ProgressPercent}% complete");
};

using var input = new OcrInput();
input.LoadImage("large_parking_lot.jpg");

var result = ocr.ReadLicensePlate(input);
$vbLabelText   $csharpLabel

For detailed performance monitoring, explore the progress tracking capabilities in IronOCR.

How Does This Compare to Other Document Reading?

IronOCR's specialized document reading capabilities extend beyond license plates. The same computer vision technology that powers license plate detection can be applied to:

What Are Common Use Cases?

License plate recognition with IronOCR enables various applications:

  • Parking Management: Automate entry/exit logging and payment processing
  • Toll Collection: Speed up vehicle identification at toll booths
  • Security Surveillance: Track vehicle movements in restricted areas
  • Fleet Management: Monitor company vehicles and logistics
  • Law Enforcement: Identify vehicles of interest quickly

Each use case benefits from IronOCR's high accuracy and the ability to process images in real-time, making it suitable for both batch processing and live applications.

Frequently Asked Questions

How do I read license plates from images in C#?

You can read license plates in C# using IronOCR's ReadLicensePlate method. Simply create an IronTesseract instance and call ReadLicensePlate with an OcrInput containing your license plate image. The method returns an OcrLicensePlateResult with the extracted plate text and confidence score.

What package do I need to install for license plate recognition?

To use the license plate recognition functionality in IronOCR, you need to install both the main IronOCR package and the IronOcr.Extension.AdvancedScan package from NuGet. The AdvancedScan extension provides the specialized ReadLicensePlate method.

Can I extract license plates with just one line of code?

Yes, IronOCR allows you to extract license plate text with a single line of code: OcrLicensePlateResult result = new IronTesseract().ReadLicensePlate(new OcrInput("plate.jpg")); This returns both the plate number and confidence score immediately.

What languages are supported for license plate recognition?

IronOCR's ReadLicensePlate method currently supports license plates with English, Chinese, Japanese, Korean, and Latin alphabet scripts. The method is optimized specifically for these character sets.

How can I improve the accuracy of license plate reading?

You can improve accuracy in IronOCR by whitelisting specific characters that appear in license plates, ensuring the image contains only the license plate without headers or footers, and using high-quality images. The ReadLicensePlate method is already optimized specifically for license plate recognition.

What are the system requirements for license plate recognition on .NET Framework?

When using IronOCR's advanced scan features including ReadLicensePlate on .NET Framework, your project must run on x64 architecture. This requirement ensures optimal performance for the license plate recognition functionality.

What information does the license plate recognition return?

IronOCR's ReadLicensePlate method returns an OcrLicensePlateResult object containing the extracted license plate text and a confidence score. This allows you to both retrieve the plate number and assess the reliability of the OCR result.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Nuget Downloads 5,269,558 | Version: 2025.12 just released