使用 C# 和 .NET 进行波兰语 OCR 识别
This article was translated from English: Does it need improvement?
TranslatedView the article in English
Other versions of this document:
IronOCR 是一个 C# 软件组件,它允许 .NET 开发人员从图像和 PDF 文档中读取 126 种语言(包括波兰语)的文本。 它是 Tesseract 的一个高级分支,专为 .NET 开发人员构建,在速度和准确性方面通常优于其他 Tesseract 引擎。
IronOcr.Languages.Polish 的内容
此软件包包含 43 种适用于 .NET 的 OCR 语言:
- 抛光
- PolishBest
- PolishFast
下载
波兰语语言包:
安装
首先要做的是将波兰语OCR 包安装到您的 .NET 项目中。
要使用 NuGet 包管理器进行安装,请执行以下命令:
Install-Package IronOCR.Languages.Polish
代码示例
此 C# 代码示例演示了如何使用 IronOCR 从图像或 PDF 文档中读取波兰语文本。
// Install the IronOcr.Languages.Polish package via NuGet before using this code.
using IronOcr;
public class PolishOcrExample
{
public void ReadPolishTextFromImage()
{
// Initialize the IronTesseract object
var Ocr = new IronTesseract();
// Set the language to Polish
Ocr.Language = OcrLanguage.Polish;
// Provide the path to the image or PDF file containing Polish text
using (var Input = new OcrInput(@"images\Polish.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Display or process the recognized text
Console.WriteLine(AllText);
}
}
}// Install the IronOcr.Languages.Polish package via NuGet before using this code.
using IronOcr;
public class PolishOcrExample
{
public void ReadPolishTextFromImage()
{
// Initialize the IronTesseract object
var Ocr = new IronTesseract();
// Set the language to Polish
Ocr.Language = OcrLanguage.Polish;
// Provide the path to the image or PDF file containing Polish text
using (var Input = new OcrInput(@"images\Polish.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Display or process the recognized text
Console.WriteLine(AllText);
}
}
}$vbLabelText $csharpLabel
该脚本初始化 OCR 引擎,指定语言(波兰语),并处理位于"images\Polish.png"的图像以提取和显示文本。 请确保文件路径正确,并在运行代码之前安装 OCR 软件包。





