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);
}
}
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
Top comments (0)