Read License Plate

// This example demonstrates how to use the IronTesseract OCR engine to recognize and extract text from a license plate image.
// Ensure you have added a reference to the IronOCR library in your project.

using System;
using IronOcr; // Import the IronOcr namespace

class Program
{
    static void Main()
    {
        // Create an instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Initialize the OcrInput object and load the image containing the license plate
        using (var Input = new OcrInput())
        {
            // Load the license plate image from a file
            Input.AddImage("LicensePlate.jpeg");

            // Perform the OCR recognition process specifically for license plates
            var Result = Ocr.Read(Input);

            // Retrieve the recognized license plate's bounding box coordinates
            // If the OCR is enhanced to detect specific license plates, it may provide specific methods or properties
            foreach (var page in Result.Pages)
            {
                foreach (var word in page.Words)
                {
                    if (word.IsLicensePlate)
                    {
                        Console.WriteLine("License Plate Found:");
                        Console.WriteLine($"License Plate Text: {word.Text}");
                        Console.WriteLine($"Bounding Box: {word.Bounds}");
                    }
                }
            }
        }
    }
}
// This example demonstrates how to use the IronTesseract OCR engine to recognize and extract text from a license plate image.
// Ensure you have added a reference to the IronOCR library in your project.

using System;
using IronOcr; // Import the IronOcr namespace

class Program
{
    static void Main()
    {
        // Create an instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Initialize the OcrInput object and load the image containing the license plate
        using (var Input = new OcrInput())
        {
            // Load the license plate image from a file
            Input.AddImage("LicensePlate.jpeg");

            // Perform the OCR recognition process specifically for license plates
            var Result = Ocr.Read(Input);

            // Retrieve the recognized license plate's bounding box coordinates
            // If the OCR is enhanced to detect specific license plates, it may provide specific methods or properties
            foreach (var page in Result.Pages)
            {
                foreach (var word in page.Words)
                {
                    if (word.IsLicensePlate)
                    {
                        Console.WriteLine("License Plate Found:");
                        Console.WriteLine($"License Plate Text: {word.Text}");
                        Console.WriteLine($"Bounding Box: {word.Bounds}");
                    }
                }
            }
        }
    }
}
' This example demonstrates how to use the IronTesseract OCR engine to recognize and extract text from a license plate image.
' Ensure you have added a reference to the IronOCR library in your project.

Imports System
Imports IronOcr ' Import the IronOcr namespace

Friend Class Program
	Shared Sub Main()
		' Create an instance of the IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

		' Initialize the OcrInput object and load the image containing the license plate
		Using Input = New OcrInput()
			' Load the license plate image from a file
			Input.AddImage("LicensePlate.jpeg")

			' Perform the OCR recognition process specifically for license plates
			Dim Result = Ocr.Read(Input)

			' Retrieve the recognized license plate's bounding box coordinates
			' If the OCR is enhanced to detect specific license plates, it may provide specific methods or properties
			For Each page In Result.Pages
				For Each word In page.Words
					If word.IsLicensePlate Then
						Console.WriteLine("License Plate Found:")
						Console.WriteLine($"License Plate Text: {word.Text}")
						Console.WriteLine($"Bounding Box: {word.Bounds}")
					End If
				Next word
			Next page
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

This approach effectively extracts license plate numbers from images using the IronTesseract OCR engine. The example illustrates:

  1. IronTesseract Initialization: An instance of IronTesseract is created to handle OCR operations.
  2. Image Loading: The image file containing the license plate is loaded using the OcrInput class.
  3. OCR Process: The Read method is used on the OcrInput object, which performs OCR and identifies text from the image.
  4. Result Analysis: The recognized words are iterated. If any word is identified as a license plate, its text and bounding box are printed.

This code can be particularly useful in applications related to parking management, vehicle access control, and automated recognition systems.