Marathi OCR in C# and .NET
Inne wersje tego dokumentu:
IronOCR to komponent oprogramowania C#, który pozwala programistom .NET na odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym w języku marathi.
Jest to zaawansowany fork Tesseract, stworzony wyłącznie dla programistów .NET i regularnie przewyższa inne silniki Tesseract zarówno pod względem szybkości, jak i dokładności.
Zawartość IronOcr.Languages.Marathi
Ten pakiet zawiera 46 języków OCR dla .NET:
- Marathi
- MarathiBest
- MarathiFast
Pobieranie
Marathi Language Pack [मराठी]
Instalacja
Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie pakietu OCR dla Marathi w projekcie .NET.
Install-Package IronOcr.Languages.Marathi
Przyklad kodu
Ten przykład kodu C# odczytuje tekst w języku marathi z obrazu lub dokumentu PDF.
// Include the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Initialize the OCR engine
var Ocr = new IronTesseract();
// Specify the language as Marathi
Ocr.Language = OcrLanguage.Marathi;
// Load the image or PDF document to be processed
using (var Input = new OcrInput(@"images\Marathi.png"))
{
// Perform OCR on the input document
var Result = Ocr.Read(Input);
// Get the recognized text
var AllText = Result.Text;
// Output the recognized text to console
Console.WriteLine(AllText);
}
}
}
// Include the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Initialize the OCR engine
var Ocr = new IronTesseract();
// Specify the language as Marathi
Ocr.Language = OcrLanguage.Marathi;
// Load the image or PDF document to be processed
using (var Input = new OcrInput(@"images\Marathi.png"))
{
// Perform OCR on the input document
var Result = Ocr.Read(Input);
// Get the recognized text
var AllText = Result.Text;
// Output the recognized text to console
Console.WriteLine(AllText);
}
}
}
' Include the IronOcr namespace
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Initialize the OCR engine
Dim Ocr = New IronTesseract()
' Specify the language as Marathi
Ocr.Language = OcrLanguage.Marathi
' Load the image or PDF document to be processed
Using Input = New OcrInput("images\Marathi.png")
' Perform OCR on the input document
Dim Result = Ocr.Read(Input)
' Get the recognized text
Dim AllText = Result.Text
' Output the recognized text to console
Console.WriteLine(AllText)
End Using
End Sub
End Class
Wyjaśnienie:
- Ten kod używa klasy
IronTesseractz bibliotekiIronOCRdo wykonania OCR. - Właściwość
Ocr.Languagejest ustawiona na używanie pakietu językowego marathi. - Tworzony jest
OcrInputz użyciem ścieżki do obrazu lub PDF zawierającej tekst w języku marathi. - Metoda
Ocr.Read()przetwarza dane wejściowe i wyodrębnia tekst. - Rozpoznany tekst jest przechowywany w zmiennej
AllTexti drukowany na konsolę.

