OCR 圖像的區域
此示例通過選擇圖像的特定區域在 .NET 中執行 OCR,實現了 41% 的速度提升。
這些被稱為ContentAreas
或CropAreas
。
How to Crop Specific Area of Image in C#
- 下載 C# 函式庫以裁剪影像的特定區域
- 初始化
IronTesseract
類別。 - 用指定的區域實例化
CropRectangle
物件 - 使用
AddImage
方法添加圖像以及裁剪細節。 - 使用
Read
方法從指定區域讀取
using IronOcr; using IronSoftware.Drawing; using System; var ocrTesseract = new IronTesseract(); using var ocrInput = new OcrInput(); // A 41% improvement on speed by specifiying a pixel region var ContentArea = new Rectangle(x: 215, y: 1250, width: 1335, height: 280); ocrInput.LoadImage("img/example.png", ContentArea); var ocrResult = ocrTesseract.Read(ocrInput); Console.WriteLine(ocrResult.Text);
Imports IronOcr Imports IronSoftware.Drawing Imports System Private ocrTesseract = New IronTesseract() Private ocrInput = New OcrInput() ' A 41% improvement on speed by specifiying a pixel region Private ContentArea = New Rectangle(x:= 215, y:= 1250, width:= 1335, height:= 280) ocrInput.LoadImage("img/example.png", ContentArea) Dim ocrResult = ocrTesseract.Read(ocrInput) Console.WriteLine(ocrResult.Text)
Install-Package IronOcr
此示例通過選擇圖像的特定區域在 .NET 中執行 OCR,實現了 41% 的速度提升。
這些被稱為ContentAreas
或CropAreas
。
IronTesseract
類別。CropRectangle
物件AddImage
方法添加圖像以及裁剪細節。Read
方法從指定區域讀取