Panjabi OCR in C# and .NET
Inne wersje tego dokumentu:
IronOCR to komponent oprogramowania C#, który pozwala programistom .NET czytać tekst z obrazów i dokumentów PDF w 126 językach, w tym w języku panjabi. 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.Panjabi
Ten pakiet zawiera 46 języków OCR dla .NET:
- Panjabi
- PanjabiBest
- PanjabiFast
Pobieranie
Panjabi Language Pack [ਪਜਾਬੀ]
Instalacja
Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie pakietu Panjabi OCR w twoim projekcie .NET.
Install-Package IronOcr.Languages.Panjabi
Przyklad kodu
Ten przykład kodu C# odczytuje tekst panjabi z obrazu lub dokumentu PDF.
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the language to Panjabi
Ocr.Language = OcrLanguage.Panjabi;
// Define the input image or PDF file
using (var Input = new OcrInput(@"images\Panjabi.png"))
{
// Perform OCR on the input file
var Result = Ocr.Read(Input);
// Extract and store the recognized text from the OCR result
var AllText = Result.Text;
}
}
}
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the language to Panjabi
Ocr.Language = OcrLanguage.Panjabi;
// Define the input image or PDF file
using (var Input = new OcrInput(@"images\Panjabi.png"))
{
// Perform OCR on the input file
var Result = Ocr.Read(Input);
// Extract and store the recognized text from the OCR result
var AllText = Result.Text;
}
}
}
' Import the IronOcr namespace
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create a new instance of the IronTesseract class
Dim Ocr = New IronTesseract()
' Set the language to Panjabi
Ocr.Language = OcrLanguage.Panjabi
' Define the input image or PDF file
Using Input = New OcrInput("images\Panjabi.png")
' Perform OCR on the input file
Dim Result = Ocr.Read(Input)
' Extract and store the recognized text from the OCR result
Dim AllText = Result.Text
End Using
End Sub
End Class
Wyjaśnienie
- IronTesseract: Jest to główna klasa dostarczana przez IronOCR do operacji OCR.
- Ocr.Language: Określamy, jakiego języka silnik OCR powinien używać. Tutaj jest ustawiony na panjabi.
- OcrInput: Ta klasa służy do określenia pliku wejściowego (obraz lub PDF), na którym trzeba przeprowadzić OCR.
- Ocr.Read(): Ta metoda wykonuje rzeczywiste zadanie OCR i zwraca wynik zawierający wydobyty tekst.
- Result.Text: Zawiera wydobyty tekst po wykonaniu OCR na pliku wejściowym.
Ten przykład demonstruje, jak efektywnie korzystać z biblioteki IronOCR do wyodrębniania tekstu panjabi z obrazów lub dokumentów PDF w aplikacji .NET.

