DEV Community

IronSoftware
IronSoftware

Posted on • Originally published at ironsoftware.com

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)