此範例說明如何透過選擇影像的特定區域來提高OCR(光學字符識別)速度在.NET中。 這些被稱為ContentAreas或CropAreas。
如何在 C# 中裁切影像的特定區域
- 下載一個C#程式庫以裁剪影像的特定區域
- 實例化
IronTesseract類別。 - 使用指定的區域初始化
Rectangle物件。 - 使用
LoadImage方法將影像和裁剪詳情一起添加。 - 使用
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 UsingImports 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此範例說明如何透過選擇影像的特定區域來提高OCR(光學字符識別)速度在.NET中。 這些被稱為ContentAreas或CropAreas。
IronTesseract類別。Rectangle物件。LoadImage方法將影像和裁剪詳情一起添加。Read方法從指定區域讀取資料。NuGet 下載次數 6,394,824|版本:2026.11剛剛發布
Tesseract OCR在您需要的語言,我們支援超過125種。