DEV Community

IronSoftware
IronSoftware

Posted on • Originally published at ironsoftware.com

1 1

OCR with Barcode & QR Reading

The Iron Tesseract OcrResult object will read barcodes and QR Codes during OCR if Ocr.Configuration.ReadBarCodes = true;

This is just one of Iron Softwares valuable additions to vanilla/free Tesseract functionality.

C#:

var Ocr = new IronTesseract();
Ocr.Configuration.ReadBarCodes = true;
using (var Input = new OcrInput(@"images\imageWithBarcode.png"))
{
    var Result = Ocr.Read(Input);
    foreach (var barcode in Result.Barcodes) {
        Console.WriteLine(barcode.Value);
    }
}
Enter fullscreen mode Exit fullscreen mode

VB:

Dim Ocr = New IronTesseract()
Ocr.Configuration.ReadBarCodes = True
Using Input = New OcrInput("images\imageWithBarcode.png")
    Dim Result = Ocr.Read(Input)
    For Each barcode In Result.Barcodes
        Console.WriteLine(barcode.Value)
    Next barcode
End Using
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay