Hindi OCR in C# and .NET
Other versions of this document:
IronOCR is a C# software component allowing .NET coders to read text from images and PDF documents in 126 languages, including Hindi.
It is an advanced fork of Tesseract, built exclusively for .NET developers and regularly outperforms other Tesseract engines for both speed and accuracy.
Contents of IronOcr.Languages.Hindi
This package contains 40 OCR languages for .NET:
- Hindi
- HindiBest
- HindiFast
Download
Hindi Language Pack [हिन्दी]
Installation
The first thing we have to do is install our Hindi OCR package to your .NET project.
Install-Package IronOCR.Languages.Hindi
Code Example
This C# code example reads Hindi text from an image or PDF document.
// Make sure to install IronOcr.Languages.Hindi package before running the code
using IronOcr;
var Ocr = new IronTesseract(); // Create a new instance of the OCR engine
Ocr.Language = OcrLanguage.Hindi; // Set the language to Hindi
// Load the image file containing Hindi text
using (var Input = new OcrInput(@"images\Hindi.png"))
{
// Perform OCR on the image
var Result = Ocr.Read(Input);
// Extract the recognized text
var AllText = Result.Text;
// Optionally, you can print the extracted text
Console.WriteLine(AllText);
}
// Make sure to install IronOcr.Languages.Hindi package before running the code
using IronOcr;
var Ocr = new IronTesseract(); // Create a new instance of the OCR engine
Ocr.Language = OcrLanguage.Hindi; // Set the language to Hindi
// Load the image file containing Hindi text
using (var Input = new OcrInput(@"images\Hindi.png"))
{
// Perform OCR on the image
var Result = Ocr.Read(Input);
// Extract the recognized text
var AllText = Result.Text;
// Optionally, you can print the extracted text
Console.WriteLine(AllText);
}
' Make sure to install IronOcr.Languages.Hindi package before running the code
Imports IronOcr
Private Ocr = New IronTesseract() ' Create a new instance of the OCR engine
Ocr.Language = OcrLanguage.Hindi ' Set the language to Hindi
' Load the image file containing Hindi text
Using Input = New OcrInput("images\Hindi.png")
' Perform OCR on the image
Dim Result = Ocr.Read(Input)
' Extract the recognized text
Dim AllText = Result.Text
' Optionally, you can print the extracted text
Console.WriteLine(AllText)
End Using
Note: Make sure the file path to
Hindi.png
is correct and the necessary packages are installed.