本示例演示了通过在 .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刚刚发布