导出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 文档中每个字符、单词、行或段落的图像和坐标。