Serbian OCR in C# and .NET
Inne wersje tego dokumentu:
IronOCR to komponent oprogramowania C# umożliwiający programistom .NET odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym serbskim. Jest to zaawansowany fork Tesseracta, zbudowany wyłącznie dla deweloperów .NET i regularnie przewyższający inne silniki Tesseract pod względem szybkości i dokładności.
Zawartość IronOcr.Languages.Serbian
Ten pakiet zawiera 105 języków OCR dla .NET:
- Serbski
- SerbskiBest
- SerbskiFast
- SerbskiLatin
- SerbskiLatinBest
- SerbskiLatinFast
Pobieranie
Serbian Language Pack [српски језик]
Instalacja
Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie naszego pakietu Serbski OCR do twojego projektu .NET.
Install-Package IronOcr.Languages.Serbian
Przyklad kodu
Ten przykład kodu C# odczytuje tekst serbski z obrazu lub dokumentu 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
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
Friend Class Program
Shared Sub Main()
' Create a new instance of IronTesseract
Dim Ocr = New IronTesseract()
' Set the language to Serbian
Ocr.Language = OcrLanguage.Serbian
' Use a using statement to ensure resources are disposed properly
Using Input = 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 Class
Wyjaśnienie kodu:
- Inicjalizujemy nową instancję
IronTesseractużywaną do wykonywania OCR. - Język silnika OCR jest ustawiony na Serbski za pomocą
OcrLanguage.Serbian. - Ładujemy obraz
Serbian.pngużywającOcrInput, który czyta plik z określonej ścieżki. - Funkcja
Readjest wywoływana na obiekcie OCR w celu przetworzenia obrazu i wyodrębnienia tekstu. - Wyodrębniony tekst z obrazu jest przechowywany w zmiennej
AllText, a następnie wyświetlany w konsoli.

