Serbian OCR in C# and .NET
Curtis Chau
Updated: 2026年4月22日
本文档的其他版本:
IronOCR 是一个 C# 软件组件,允许 .NET 程序员从图像和 PDF 文档中读取 126 种语言(包括塞尔维亚语)的文本。 它是 Tesseract 的一个高级分支,专为 .NET 开发人员构建,在速度和准确性方面通常优于其他 Tesseract 引擎。
IronOcr.Languages.Serbian 的内容
此软件包包含 105 种适用于 .NET 的 OCR 语言:
- 塞尔维亚语
- 塞尔维亚语Best
- 塞尔维亚语Fast
- 塞尔维亚拉丁语
- 塞尔维亚拉丁语Best
- 塞尔维亚拉丁语Fast
下载
塞尔维亚语语言包[塞尔维亚语]
安装
我们首先需要做的就是将我们的塞尔维亚语OCR 包安装到您的 .NET 项目中。
代码示例
此 C# 代码示例从图像或 PDF 文档中读取塞尔维亚语文本。
// Ensure all necessary namespaces are imported
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of IronTesseract
var Ocr = new IronTesseract();
// Set the language to Serbian
Ocr.Language = OcrLanguage.Serbian;
// Use a using statement to ensure resources are disposed properly
using (var Input = new OcrInput(@"images\Serbian.png"))
{
// Perform OCR and store the result
var Result = Ocr.Read(Input);
// Extract all text from the OCR result
var AllText = Result.Text;
// Output the resulting text
Console.WriteLine(AllText);
}
}
}' Ensure all necessary namespaces are imported
Imports IronOcr
Module Program
Sub Main()
' Create a new instance of IronTesseract
Dim Ocr As New IronTesseract()
' Set the language to Serbian
Ocr.Language = OcrLanguage.Serbian
' Use a Using statement to ensure resources are disposed properly
Using Input As New OcrInput("images\Serbian.png")
' Perform OCR and store the result
Dim Result = Ocr.Read(Input)
' Extract all text from the OCR result
Dim AllText = Result.Text
' Output the resulting text
Console.WriteLine(AllText)
End Using
End Sub
End Module代码说明:
- 我们初始化一个新的
IronTesseract实例,用于执行OCR。 - 使用
OcrLanguage.Serbian将OCR引擎的语言设置为塞尔维亚语。 - 我们使用
Serbian.png,该代码从指定路径读取文件。 - 调用OCR对象上的
Read函数来处理图像并提取文本。 - 从图像中提取的文本存储在变量
AllText中,然后打印到控制台。

技术作家
Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。
...
阅读更多