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方法從指定區域讀取