此範例透過選擇影像的特定區域在.NET中執行OCR(光學文字辨識)來展示41%的速度提升。 這些稱為CropAreas。
如何在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
Dim ocrTesseract = New IronTesseract()
Using ocrInput = New OcrInput()
' A 41% improvement on speed by specifiying a pixel region
Dim 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)
End Using此範例透過選擇影像的特定區域在.NET中執行OCR(光學文字辨識)來展示41%的速度提升。 這些稱為CropAreas。
IronTesseract類。CropRectangle物件。AddImage方法新增影像以及裁剪細節。Read方法從指定區域讀取。Nuget Downloads 6,236,385|版本:2026.9剛剛發布