using IronOcr;
using System;
var ocrTesseract = new IronTesseract();
ocrTesseract.Configuration.ReadBarCodes = true;
using var ocrInput = new OcrInput();
ocrInput.LoadImage(@"images\imageWithBarcode.png");
var ocrResult = ocrTesseract.Read(ocrInput);
foreach (var barcode in ocrResult.Barcodes)
{
Console.WriteLine(barcode.Value);
}
Imports IronOcr
Imports System
Private ocrTesseract = New IronTesseract()
ocrTesseract.Configuration.ReadBarCodes = True
Dim ocrInput As New OcrInput()
ocrInput.LoadImage("images\imageWithBarcode.png")
Dim ocrResult = ocrTesseract.Read(ocrInput)
For Each barcode In ocrResult.Barcodes
Console.WriteLine(barcode.Value)
Next barcode
Install-Package IronOcr
帶有條碼和 QR 讀取的 OCR
Iron Tesseract的OcrResult物件在OCR過程中如果設定Ocr.Configuration.ReadBarCodes = true;將會讀取條碼和QR碼。