匯出OCR元素的圖像
此範例展示了 IronTesseract
如何在任何 OCR 文件中提取每個字符、單詞、行或段落的圖像及座標。
using IronOcr; using IronSoftware.Drawing; var ocrTesseract = new IronTesseract(); using var ocrInput = new OcrInput(); ocrInput.LoadImage(@"images\image.png"); var ocrResult = ocrTesseract.Read(ocrInput); foreach (var page in ocrResult.Pages) { foreach (var word in page.Words) { word.ToBitmap(ocrInput).SaveAs($"page{page.PageNumber}_word{word.WordNumber}.png", AnyBitmap.ImageFormat.Png); } }
Imports IronOcr Imports IronSoftware.Drawing Private ocrTesseract = New IronTesseract() Private ocrInput = New OcrInput() ocrInput.LoadImage("images\image.png") Dim ocrResult = ocrTesseract.Read(ocrInput) For Each page In ocrResult.Pages For Each word In page.Words word.ToBitmap(ocrInput).SaveAs($"page{page.PageNumber}_word{word.WordNumber}.png", AnyBitmap.ImageFormat.Png) Next word Next page
Install-Package IronOcr
此範例展示了 IronTesseract
如何在任何 OCR 文件中提取每個字符、單詞、行或段落的圖像及座標。